mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
clocksource: Unregister subsystem on device registration failure
init_clocksource_sysfs() registers the clocksource subsystem before
registering the clocksource device. If device_register() fails, the
function returns the error while leaving the subsystem registered.
Unregister the clocksource subsystem on that failure path so the
successful subsystem registration is unwound before returning.
Fixes: d369a5d8fc ("clocksource: convert sysdev_class to a regular subsystem")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260702215733.84588-1-dbgh9129@gmail.com
This commit is contained in:
committed by
Thomas Gleixner
parent
b4b66151a7
commit
3dee6537e7
@@ -1565,8 +1565,12 @@ static int __init init_clocksource_sysfs(void)
|
||||
{
|
||||
int error = subsys_system_register(&clocksource_subsys, NULL);
|
||||
|
||||
if (!error)
|
||||
error = device_register(&device_clocksource);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = device_register(&device_clocksource);
|
||||
if (error)
|
||||
bus_unregister(&clocksource_subsys);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user