From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, davidgow <davidgow@google.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Maxime Ripard <mripard@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [linux-next:master 8829/9096] lib/kunit/device.c:138 kunit_device_register_with_driver() warn: passing zero to 'ERR_CAST'
Date: Wed, 3 Jan 2024 14:14:14 +0300 [thread overview]
Message-ID: <309f601b-4af1-4127-a20b-88256203ca1d@moroto.mountain> (raw)
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
reply other threads:[~2024-01-03 11:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=309f601b-4af1-4127-a20b-88256203ca1d@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=davidgow@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mazziesaccount@gmail.com \
--cc=mripard@kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=skhan@linuxfoundation.org \
/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