From: Dan Carpenter Date: Wed, 10 Jan 2024 18:55:14 +0000 (+0300) Subject: kunit: device: Fix a NULL vs IS_ERR() check in init() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=083974ebb8fc65978d6cacd1bcfe9158d6234b98;p=linux.git kunit: device: Fix a NULL vs IS_ERR() check in init() 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 Reviewed-by: Rae Moar Reviewed-by: David Gow Signed-off-by: Shuah Khan --- diff --git a/lib/kunit/device.c b/lib/kunit/device.c index f5371287b3750..074c6dd2e36a7 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)