2024-03-05 17:17:27

by Ritesh Harjani

[permalink] [raw]
Subject: Re: [PATCH] ext4: Remove unneeded if checks before kfree

Thorsten Blum <[email protected]> writes:

> kfree already checks if its argument is NULL. This fixes two
> Coccinelle/coccicheck warnings reported by ifnullfree.cocci.
>
> Signed-off-by: Thorsten Blum <[email protected]>
> ---
> fs/ext4/super.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>

Sure. Thanks for your patch.
Looks good to me. Feel free to add -

Reviewed-by: Ritesh Harjani (IBM) <[email protected]>


2024-03-17 15:37:40

by Thorsten Blum

[permalink] [raw]
Subject: [RESEND PATCH] ext4: Remove unneeded if checks before kfree

kfree already checks if its argument is NULL. This fixes two
Coccinelle/coccicheck warnings reported by ifnullfree.cocci.

Signed-off-by: Thorsten Blum <[email protected]>
Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
---
fs/ext4/super.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0f931d0c227d..9b7a0b4f2d3d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2079,8 +2079,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;
@@ -2485,8 +2484,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.44.0


2024-04-12 22:51:07

by Thorsten Blum

[permalink] [raw]
Subject: [RESEND PATCH] ext4: Remove unneeded if checks before kfree

kfree already checks if its argument is NULL. This fixes two
Coccinelle/coccicheck warnings reported by ifnullfree.cocci.

Signed-off-by: Thorsten Blum <[email protected]>
Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
---
fs/ext4/super.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0f931d0c227d..9b7a0b4f2d3d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2079,8 +2079,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;
@@ -2485,8 +2484,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.44.0