mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: mdshahid03@gmail.com
To: Viacheslav Dubeyko <slava@dubeyko.com>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	Yangtao Li <frank.li@vivo.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mohammad Shahid <mdshahid03@gmail.com>
Subject: [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
Date: Sun, 26 Jul 2026 12:12:28 +0530	[thread overview]
Message-ID: <20260726064228.248199-1-mdshahid03@gmail.com> (raw)
In-Reply-To: <20260726063939.247892-1-mdshahid03@gmail.com>

From: Mohammad Shahid <mdshahid03@gmail.com>

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@gmail.com>
---
 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


  reply	other threads:[~2026-07-26  6:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 10:22 mdshahid03
2026-07-24 12:40 ` mdshahid03
2026-07-24 18:17   ` Viacheslav Dubeyko
2026-07-26  6:36     ` mdshahid03
2026-07-26  6:42       ` mdshahid03 [this message]
2026-07-28  0:59         ` Viacheslav Dubeyko
2026-07-28  1:57           ` Viacheslav Dubeyko
     [not found] ` <CACRLeC5agyqVnvjdziV5C_Z+y6NPvXg1Nyv2g_mmK2D1QbsfYQ@mail.gmail.com>
2026-07-24 18:09   ` Viacheslav Dubeyko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260726064228.248199-1-mdshahid03@gmail.com \
    --to=mdshahid03@gmail.com \
    --cc=frank.li@vivo.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=slava@dubeyko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®