ext4: remove unneeded if checks before kfree
authorThorsten Blum <thorsten.blum@toblux.com>
Sun, 17 Mar 2024 15:36:39 +0000 (16:36 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 2 May 2024 18:44:51 +0000 (14:44 -0400)
kfree already checks if its argument is NULL. This fixes two
Coccinelle/coccicheck warnings reported by ifnullfree.cocci.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20240317153638.2136-2-thorsten.blum@toblux.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c

index 044135796f2b6ebe86e56b69f57501e7567d761b..28cbe0f1996f8eb47594a6dafd5cf174c02072a6 100644 (file)
@@ -2078,8 +2078,7 @@ static int unnote_qf_name(struct fs_context *fc, int qtype)
 {
        struct ext4_fs_context *ctx = fc->fs_private;
 
-       if (ctx->s_qf_names[qtype])
-               kfree(ctx->s_qf_names[qtype]);
+       kfree(ctx->s_qf_names[qtype]);
 
        ctx->s_qf_names[qtype] = NULL;
        ctx->qname_spec |= 1 << qtype;
@@ -2484,8 +2483,7 @@ static int parse_options(struct fs_context *fc, char *options)
                        param.size = v_len;
 
                        ret = ext4_parse_param(fc, &param);
-                       if (param.string)
-                               kfree(param.string);
+                       kfree(param.string);
                        if (ret < 0)
                                return ret;
                }