* [PATCH] clk: raspberrypi: Handle cpufreq device registration failure
@ 2026-09-18 4:41 Triet Hoang
2026-09-18 4:48 ` sashiko-bot
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Triet Hoang @ 2026-09-18 4:41 UTC (permalink / raw)
To: sboyd
Cc: bmasney+clk, jbrunet+clk, florian.fainelli,
bcm-kernel-feedback-list, mcanal, wahrenst, triet.hoang.dev,
linux-clk, linux-rpi-kernel, linux-arm-kernel, linux-kernel
Check the return value of platform_device_register_data() when
registering the raspberrypi-cpufreq device and propagate the error
if registration fails.
This prevents the clock driver from reporting a successful probe
when the cpufreq device could not be registered.
Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
drivers/clk/bcm/clk-raspberrypi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c
index f1a99de6de4f..9882f243d681 100644
--- a/drivers/clk/bcm/clk-raspberrypi.c
+++ b/drivers/clk/bcm/clk-raspberrypi.c
@@ -553,6 +553,8 @@ static int raspberrypi_clk_probe(struct platform_device *pdev)
rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",
-1, NULL, 0);
+ if (IS_ERR(rpi->cpufreq))
+ return PTR_ERR(rpi->cpufreq);
return 0;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: raspberrypi: Handle cpufreq device registration failure
2026-09-18 4:41 [PATCH] clk: raspberrypi: Handle cpufreq device registration failure Triet Hoang
@ 2026-09-18 4:48 ` sashiko-bot
2026-09-18 13:33 ` Stefan Wahren
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-09-18 4:48 UTC (permalink / raw)
To: Triet Hoang; +Cc: linux-clk
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] clk: raspberrypi: core clock probe fails if optional cpufreq device fails
--
commit 9a3a7cc11a038dd3ae191483f044c2febc6c2ed1
Author: Triet Hoang <triet.hoang.dev@gmail.com>
clk: raspberrypi: Handle cpufreq device registration failure
This commit adds an error check when registering the raspberrypi-cpufreq
device in the clock driver probe function. It propagates the error if the
cpufreq device fails to register, preventing a successful probe return.
> diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c
> index f1a99de6de4f1..9882f243d6813 100644
> --- a/drivers/clk/bcm/clk-raspberrypi.c
> +++ b/drivers/clk/bcm/clk-raspberrypi.c
> @@ -553,6 +553,8 @@ static int raspberrypi_clk_probe(struct platform_device *pdev)
>
> rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",
> -1, NULL, 0);
> + if (IS_ERR(rpi->cpufreq))
> + return PTR_ERR(rpi->cpufreq);
[Severity: Medium]
Does this introduce a regression where fundamental core clocks might be
unregistered if the optional cpufreq device fails?
The raspberrypi-clk driver provides essential system clocks, such as arm,
core, and pixel. By returning an error from raspberrypi_clk_probe(), devres
will automatically unregister these clocks. This can prevent other fundamental
SoC devices that depend on these clocks from probing, which could severely
degrade the system or prevent it from booting entirely.
Is it safe to structurally tie the survival of the core clocks to an optional
dynamic frequency scaling child device?
>
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260918044131.608482-1-triet.hoang.dev@gmail.com?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: raspberrypi: Handle cpufreq device registration failure
2026-09-18 4:41 [PATCH] clk: raspberrypi: Handle cpufreq device registration failure Triet Hoang
2026-09-18 4:48 ` sashiko-bot
@ 2026-09-18 13:33 ` Stefan Wahren
2026-09-18 22:10 ` Brian Masney
2026-09-18 22:12 ` Brian Masney
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Wahren @ 2026-09-18 13:33 UTC (permalink / raw)
To: Triet Hoang, sboyd
Cc: bmasney+clk, jbrunet+clk, florian.fainelli,
bcm-kernel-feedback-list, mcanal, linux-clk, linux-rpi-kernel,
linux-arm-kernel, linux-kernel
Hi Triet,
nice catch.
Am 18.09.26 um 06:41 schrieb Triet Hoang:
> Check the return value of platform_device_register_data() when
> registering the raspberrypi-cpufreq device and propagate the error
> if registration fails.
>
> This prevents the clock driver from reporting a successful probe
> when the cpufreq device could not be registered.
>
> Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
Reviewed-by: Stefan Wahren <wahrenst@gmx.net>
Could you please add a Fixes tag?
Also it would be nice, if you can send a patch which also fixes
drivers/firmware/raspberrypi.c
Thanks
> ---
> drivers/clk/bcm/clk-raspberrypi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c
> index f1a99de6de4f..9882f243d681 100644
> --- a/drivers/clk/bcm/clk-raspberrypi.c
> +++ b/drivers/clk/bcm/clk-raspberrypi.c
> @@ -553,6 +553,8 @@ static int raspberrypi_clk_probe(struct platform_device *pdev)
>
> rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",
> -1, NULL, 0);
> + if (IS_ERR(rpi->cpufreq))
> + return PTR_ERR(rpi->cpufreq);
>
> return 0;
> }
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: raspberrypi: Handle cpufreq device registration failure
2026-09-18 4:41 [PATCH] clk: raspberrypi: Handle cpufreq device registration failure Triet Hoang
2026-09-18 4:48 ` sashiko-bot
2026-09-18 13:33 ` Stefan Wahren
@ 2026-09-18 22:10 ` Brian Masney
2026-09-18 22:12 ` Brian Masney
3 siblings, 0 replies; 5+ messages in thread
From: Brian Masney @ 2026-09-18 22:10 UTC (permalink / raw)
To: Triet Hoang
Cc: sboyd, bmasney+clk, jbrunet+clk, florian.fainelli,
bcm-kernel-feedback-list, mcanal, wahrenst, linux-clk,
linux-rpi-kernel, linux-arm-kernel, linux-kernel
On Fri, Sep 18, 2026 at 11:41:30AM +0700, Triet Hoang wrote:
> Check the return value of platform_device_register_data() when
> registering the raspberrypi-cpufreq device and propagate the error
> if registration fails.
>
> This prevents the clock driver from reporting a successful probe
> when the cpufreq device could not be registered.
>
> Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
Fixes: e2bb18347c8e5 ("clk: raspberrypi: register platform device for raspberrypi-cpufreq")
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: raspberrypi: Handle cpufreq device registration failure
2026-09-18 4:41 [PATCH] clk: raspberrypi: Handle cpufreq device registration failure Triet Hoang
` (2 preceding siblings ...)
2026-09-18 22:10 ` Brian Masney
@ 2026-09-18 22:12 ` Brian Masney
3 siblings, 0 replies; 5+ messages in thread
From: Brian Masney @ 2026-09-18 22:12 UTC (permalink / raw)
To: sboyd, Triet Hoang
Cc: bmasney+clk, jbrunet+clk, florian.fainelli,
bcm-kernel-feedback-list, mcanal, wahrenst, linux-clk,
linux-rpi-kernel, linux-arm-kernel, linux-kernel
On Fri, 18 Sep 2026 11:41:30 +0700, Triet Hoang wrote:
> clk: raspberrypi: Handle cpufreq device registration failure
Applied, thanks!
[1/1] clk: raspberrypi: Handle cpufreq device registration failure
commit: e98e3d712023859af7cd78bb7fdb87ea3a9ffb83
Best regards,
--
Brian Masney <bmasney@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-18 22:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 4:41 [PATCH] clk: raspberrypi: Handle cpufreq device registration failure Triet Hoang
2026-09-18 4:48 ` sashiko-bot
2026-09-18 13:33 ` Stefan Wahren
2026-09-18 22:10 ` Brian Masney
2026-09-18 22:12 ` Brian Masney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox