[linux-next:master 8829/9096] lib/kunit/device.c:138 kunit_device_register_with_driver() warn: passing zero to 'ERR_CAST'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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@xxxxxxxxxx 2023-12-15  131  struct device *kunit_device_register_with_driver(struct kunit *test,
d03c720e03bd9b davidgow@xxxxxxxxxx 2023-12-15  132  						 const char *name,
d03c720e03bd9b davidgow@xxxxxxxxxx 2023-12-15  133  						 const struct device_driver *drv)
d03c720e03bd9b davidgow@xxxxxxxxxx 2023-12-15  134  {
d03c720e03bd9b davidgow@xxxxxxxxxx 2023-12-15  135  	struct kunit_device *kunit_dev = kunit_device_register_internal(test, name, drv);
d03c720e03bd9b davidgow@xxxxxxxxxx 2023-12-15  136  
d03c720e03bd9b davidgow@xxxxxxxxxx 2023-12-15  137  	if (IS_ERR_OR_NULL(kunit_dev))
d03c720e03bd9b davidgow@xxxxxxxxxx 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@xxxxxxxxxx 2023-12-15  139  
d03c720e03bd9b davidgow@xxxxxxxxxx 2023-12-15  140  	return &kunit_dev->dev;
d03c720e03bd9b davidgow@xxxxxxxxxx 2023-12-15  141  }

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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux