fs/hfsplus/unicode_test.c:43:2-7: WARNING: NULL check before some freeing functions is not needed.

From: kernel test robot

Date: Wed Mar 25 2026 - 04:28:46 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bbeb83d3182abe0d245318e274e8531e5dd7a948
commit: 6f84ceb98538523f49d544aa7c671c87cc23d1b1 hfsplus: introduce KUnit tests for HFS+ string operations
date: 4 months ago
config: s390-randconfig-r052-20260323 (https://download.01.org/0day-ci/archive/20260325/202603251610.9L4pAi7A-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project c911b8492374942bf4cfe35411e90a35d3837f6a)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603251610.9L4pAi7A-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> fs/hfsplus/unicode_test.c:43:2-7: WARNING: NULL check before some freeing functions is not needed.

vim +43 fs/hfsplus/unicode_test.c

39
40 static void free_mock_str_env(struct test_mock_string_env *env)
41 {
42 if (env->buf)
> 43 kfree(env->buf);
44 kfree(env);
45 }
46

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki