[PATCH] clk: raspberrypi: Handle cpufreq device registration failure

Triet Hoang posted 1 patch 6 days, 19 hours ago
drivers/clk/bcm/clk-raspberrypi.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] clk: raspberrypi: Handle cpufreq device registration failure
Posted by Triet Hoang 6 days, 19 hours ago
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
Re: [PATCH] clk: raspberrypi: Handle cpufreq device registration failure
Posted by Brian Masney 6 days, 1 hour ago
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")
Re: [PATCH] clk: raspberrypi: Handle cpufreq device registration failure
Posted by Brian Masney 6 days, 1 hour ago
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>
Re: [PATCH] clk: raspberrypi: Handle cpufreq device registration failure
Posted by Stefan Wahren 6 days, 10 hours ago
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;
>   }