All of lore.kernel.org
 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'
@ 2023-12-19 17:06 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-12-19 17:06 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: davidgow <davidgow@google.com>
CC: Shuah Khan <skhan@linuxfoundation.org>
CC: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>, Matti Vaittinen <mazziesaccount@gmail.com>
CC: Maxime Ripard <mripard@kernel.org>
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>

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
:::::: branch date: 12 hours ago
:::::: commit date: 21 hours ago
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 <error27@gmail.com>
| 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  126  
d03c720e03bd9b davidgow@google.com 2023-12-15  127  /**
d03c720e03bd9b davidgow@google.com 2023-12-15  128   * Create and register a new KUnit-managed device, using the user-supplied device_driver.
d03c720e03bd9b davidgow@google.com 2023-12-15  129   * On failure, returns an error pointer.
d03c720e03bd9b davidgow@google.com 2023-12-15  130   */
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);
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  }
d03c720e03bd9b davidgow@google.com 2023-12-15  142  EXPORT_SYMBOL_GPL(kunit_device_register_with_driver);
d03c720e03bd9b davidgow@google.com 2023-12-15  143  

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [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; 2+ messages 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] 2+ messages in thread

end of thread, other threads:[~2024-01-03 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 17:06 [linux-next:master 8829/9096] lib/kunit/device.c:138 kunit_device_register_with_driver() warn: passing zero to 'ERR_CAST' kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2024-01-03 11:14 Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.