udf: improve error management in udf_CS0toNLS()
authorFabian Frederick <fabf@skynet.be>
Wed, 8 Apr 2015 19:23:55 +0000 (21:23 +0200)
committerJan Kara <jack@suse.cz>
Mon, 18 May 2015 09:23:05 +0000 (11:23 +0200)
Only callsite udf_get_filename() now returns error code as well.

Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/udf/unicode.c

index 35cc9477b066aed431b2352cd49ebb6f05025c79..658aa14cc474733429c06338a6017be995b6a217 100644 (file)
@@ -265,7 +265,7 @@ static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o,
                memset(utf_o, 0, sizeof(struct ustr));
                pr_err("unknown compression code (%d) stri=%s\n",
                       cmp_id, ocu_i->u_name);
-               return 0;
+               return -EINVAL;
        }
 
        ocu = ocu_i->u_name;
@@ -357,8 +357,9 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen,
                        goto out2;
                }
        } else if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) {
-               if (!udf_CS0toNLS(UDF_SB(sb)->s_nls_map, filename,
-                                 unifilename)) {
+               ret = udf_CS0toNLS(UDF_SB(sb)->s_nls_map, filename,
+                                  unifilename);
+               if (ret < 0) {
                        udf_debug("Failed in udf_get_filename: sname = %s\n",
                                  sname);
                        goto out2;