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: d03c720e03 ("kunit: Add APIs for managing devices")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Rae Moar <rmoar@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
Dan Carpenter 2024-01-10 21:55:14 +03:00 committed by Shuah Khan
parent ed1a72fb0d
commit 083974ebb8
1 changed files with 2 additions and 2 deletions

View File

@ -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)