summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWander Lairson Costa <wander@redhat.com>2024-04-19 16:25:01 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-30 10:44:32 +0300
commitdfd7f89a395cf89245590b3c65b56326d86ec466 (patch)
tree303c80333be4a08a938b7f8771cbee01a48a619a
parentb0b755cb5a5e0d7168c3ab1b3814b0d3cad9f017 (diff)
downloadlinux-dfd7f89a395cf89245590b3c65b56326d86ec466.tar.xz
kunit: unregister the device on error
[ Upstream commit fabd480b721eb30aa4e2c89507b53933069f9f6e ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--lib/kunit/device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/kunit/device.c b/lib/kunit/device.c
index abc603730b8e..25c81ed465fb 100644
--- a/lib/kunit/device.c
+++ b/lib/kunit/device.c
@@ -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;
}