]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kunit: unregister the device on error
authorWander Lairson Costa <wander@redhat.com>
Fri, 19 Apr 2024 13:25:01 +0000 (10:25 -0300)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 6 May 2024 20:22:02 +0000 (14:22 -0600)
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: d03c720e03bd ("kunit: Add APIs for managing devices")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/device.c

index abc603730b8ea4e55e320419b671130a2266f0a3..25c81ed465fb77cccfc4bb0c0d4e3fdb548a4dd4 100644 (file)
@@ -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;
 }