Skip to content

Commit

Permalink
kunit: unregister the device on error
Browse files Browse the repository at this point in the history
kunit_init_device() should unregister the device on bus register error,
but mistakenly it tries to unregister the bus.

Unregister the device instead of the bus.

Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Fixes: d03c720 ("kunit: Add APIs for managing devices")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
walac authored and shuahkh committed May 6, 2024
1 parent 1eb69de commit fabd480
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kunit/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ int kunit_bus_init(void)

error = bus_register(&kunit_bus_type);
if (error)
bus_unregister(&kunit_bus_type);
root_device_unregister(kunit_bus_device);
return error;
}

Expand Down

0 comments on commit fabd480

Please sign in to comment.