From: Dan Carpenter <dan.carpenter@linaro.org>
To: "davidgow@google.com" <davidgow@google.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>,
Shuah Khan <skhan@linuxfoundation.org>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Maxime Ripard <mripard@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] kunit: device: Fix a NULL vs IS_ERR() check in init()
Date: Wed, 10 Jan 2024 21:55:14 +0300 [thread overview]
Message-ID: <dd938a86-38d9-4d62-abd0-1df80395fbbd@moroto.mountain> (raw)
The root_device_register() function does not return NULL, it returns
error pointers. Fix the check to match.
Fixes: d03c720e03bd ("kunit: Add APIs for managing devices")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
lib/kunit/device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/kunit/device.c b/lib/kunit/device.c
index f5371287b375..074c6dd2e36a 100644
--- a/lib/kunit/device.c
+++ b/lib/kunit/device.c
@@ -45,8 +45,8 @@ int kunit_bus_init(void)
int error;
kunit_bus_device = root_device_register("kunit");
- if (!kunit_bus_device)
- return -ENOMEM;
+ if (IS_ERR(kunit_bus_device))
+ return PTR_ERR(kunit_bus_device);
error = bus_register(&kunit_bus_type);
if (error)
--
2.43.0
next reply other threads:[~2024-01-10 18:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 18:55 Dan Carpenter [this message]
2024-01-10 21:09 ` Rae Moar
2024-01-11 23:42 ` David Gow
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=dd938a86-38d9-4d62-abd0-1df80395fbbd@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=brendan.higgins@linux.dev \
--cc=davidgow@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=mripard@kernel.org \
--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
all inboxes | Powered by JetHome®