[PATCH] fs: hfsplus: remove redundant NULL check before kfree()
From: mdshahid03
Date: Fri Jul 03 2026 - 06:26:19 EST
From: Mohammad Shahid <mdshahid03@xxxxxxxxx>
kfree() safely handles NULL pointers, so the explicit NULL check
before calling kfree() is unnecessary.
This issue was reported by ifnullfree.cocci.
Signed-off-by: Mohammad Shahid <mdshahid03@xxxxxxxxx>
---
fs/hfsplus/unicode_test.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/hfsplus/unicode_test.c b/fs/hfsplus/unicode_test.c
index 83737c9bafa0..7f6b2a3c69d9 100644
--- a/fs/hfsplus/unicode_test.c
+++ b/fs/hfsplus/unicode_test.c
@@ -39,8 +39,7 @@ static struct test_mock_string_env *setup_mock_str_env(u32 buf_size)
static void free_mock_str_env(struct test_mock_string_env *env)
{
- if (env->buf)
- kfree(env->buf);
+ kfree(env->buf);
kfree(env);
}
--
2.43.0