[PATCH -next] ext4: NULL check before some freeing functions is not needed

Li Zetao posted 1 patch 2 years, 6 months ago
fs/ext4/super.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
[PATCH -next] ext4: NULL check before some freeing functions is not needed
Posted by Li Zetao 2 years, 6 months ago
Fix below warnings reported by coccicheck:
fs/ext4/super.c:2472:4-9: WARNING: NULL check before some freeing functions is not needed.
fs/ext4/super.c:2057:2-7: WARNING: NULL check before some freeing functions is not needed.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
 fs/ext4/super.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index b54c70e1a74e..27d5aea1f715 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2053,9 +2053,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;
 	ctx->spec |= EXT4_SPEC_JQUOTA;
@@ -2468,8 +2466,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;
 		}
-- 
2.34.1