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:49:21 +0300
commit67364ec521f6772e25ea7ce4323b5df95a49cf63 (patch)
tree41b5576cbf55c6eecf1ed7b6d292d55b251327fd
parent8f5c841a559ccb700c8d27a3ca645b7a5f59b4f5 (diff)
downloadlinux-67364ec521f6772e25ea7ce4323b5df95a49cf63.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 9ea399049749..3a31fe9ed6fc 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;
}