Skip to content

Commit 083974e

Browse files
Dan Carpentershuahkh
authored andcommitted
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: d03c720 ("kunit: Add APIs for managing devices") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Rae Moar <[email protected]> Reviewed-by: David Gow <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent ed1a72f commit 083974e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/kunit/device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ int kunit_bus_init(void)
4545
int error;
4646

4747
kunit_bus_device = root_device_register("kunit");
48-
if (!kunit_bus_device)
49-
return -ENOMEM;
48+
if (IS_ERR(kunit_bus_device))
49+
return PTR_ERR(kunit_bus_device);
5050

5151
error = bus_register(&kunit_bus_type);
5252
if (error)

0 commit comments

Comments
 (0)