* [PATCH v1] clocksource: Unregister subsystem on device registration failure
@ 2026-07-02 21:57 Yuho Choi
2026-07-07 21:32 ` [tip: timers/core] " tip-bot2 for Yuho Choi
0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-07-02 21:57 UTC (permalink / raw)
To: John Stultz, Thomas Gleixner; +Cc: Stephen Boyd, linux-kernel, Yuho Choi
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: d369a5d8fc70 ("clocksource: convert sysdev_class to a regular subsystem")
Signed-off-by: Yuho Choi <dbgh9129@gmail.com>
---
kernel/time/clocksource.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index e48c4d379a7c..5a786b3c778c 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -1566,8 +1566,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;
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip: timers/core] clocksource: Unregister subsystem on device registration failure
2026-07-02 21:57 [PATCH v1] clocksource: Unregister subsystem on device registration failure Yuho Choi
@ 2026-07-07 21:32 ` tip-bot2 for Yuho Choi
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Yuho Choi @ 2026-07-07 21:32 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Yuho Choi, Thomas Gleixner, x86, linux-kernel
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 3dee6537e728bd8137fda6eaf859f26e685943f7
Gitweb: https://git.kernel.org/tip/3dee6537e728bd8137fda6eaf859f26e685943f7
Author: Yuho Choi <dbgh9129@gmail.com>
AuthorDate: Thu, 02 Jul 2026 17:57:33 -04:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Tue, 07 Jul 2026 23:26:58 +02: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: d369a5d8fc70 ("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
---
kernel/time/clocksource.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 78c91b0..f1253f5 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-07 21:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-02 21:57 [PATCH v1] clocksource: Unregister subsystem on device registration failure Yuho Choi
2026-07-07 21:32 ` [tip: timers/core] " tip-bot2 for Yuho Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox