linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 8829/9096] lib/kunit/device.c:138 kunit_device_register_with_driver() warn: passing zero to 'ERR_CAST'
@ 2024-01-03 11:14 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2024-01-03 11:14 UTC (permalink / raw)
  To: oe-kbuild, davidgow
  Cc: lkp, oe-kbuild-all, Linux Memory Management List, Shuah Khan,
	Matti Vaittinen, Matti Vaittinen, Maxime Ripard,
	Greg Kroah-Hartman

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   aa4db8324c4d0e67aa4670356df4e9fae14b4d37
commit: d03c720e03bd9bf0b784d80b5d3ede7e2daf3b6e [8829/9096] kunit: Add APIs for managing devices
config: x86_64-randconfig-161-20231219 (https://download.01.org/0day-ci/archive/20231220/202312200124.CkSII1FB-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)

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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202312200124.CkSII1FB-lkp@intel.com/

smatch warnings:
lib/kunit/device.c:138 kunit_device_register_with_driver() warn: passing zero to 'ERR_CAST'

vim +/ERR_CAST +138 lib/kunit/device.c

d03c720e03bd9b davidgow@google.com 2023-12-15  131  struct device *kunit_device_register_with_driver(struct kunit *test,
d03c720e03bd9b davidgow@google.com 2023-12-15  132  						 const char *name,
d03c720e03bd9b davidgow@google.com 2023-12-15  133  						 const struct device_driver *drv)
d03c720e03bd9b davidgow@google.com 2023-12-15  134  {
d03c720e03bd9b davidgow@google.com 2023-12-15  135  	struct kunit_device *kunit_dev = kunit_device_register_internal(test, name, drv);
d03c720e03bd9b davidgow@google.com 2023-12-15  136  
d03c720e03bd9b davidgow@google.com 2023-12-15  137  	if (IS_ERR_OR_NULL(kunit_dev))
d03c720e03bd9b davidgow@google.com 2023-12-15 @138  		return ERR_CAST(kunit_dev);

kunit_device_register_internal() doesn't return NULL.

https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/

d03c720e03bd9b davidgow@google.com 2023-12-15  139  
d03c720e03bd9b davidgow@google.com 2023-12-15  140  	return &kunit_dev->dev;
d03c720e03bd9b davidgow@google.com 2023-12-15  141  }

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-03 11:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03 11:14 [linux-next:master 8829/9096] lib/kunit/device.c:138 kunit_device_register_with_driver() warn: passing zero to 'ERR_CAST' Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox