diff mbox series

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

Message ID 20230726093330.1389949-1-lizetao1@huawei.com
State New
Headers show
Series [-next] ext4: NULL check before some freeing functions is not needed | expand

Commit Message

Li Zetao July 26, 2023, 9:33 a.m. UTC
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 mbox series

Patch

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;
 		}