public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: versatile: vexpress-osc: Check return value of devm_of_clk_add_hw_provider() in vexpress_osc_probe()
@ 2026-02-04  6:33 Chen Ni
  2026-02-11 12:35 ` Liviu Dudau
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2026-02-04  6:33 UTC (permalink / raw)
  To: linusw, mturquette, sboyd, liviu.dudau, sudeep.holla, lpieralisi,
	robh, arnd
  Cc: linux-arm-kernel, linux-clk, linux-kernel, Chen Ni

Return the value of devm_of_clk_add_hw_provider() in order to propagate
the error properly, if it fails due to resource allocation failure or
device tree clock provider registration failure.

This ensures that the probe function fails safely rather than proceeding
with a potentially incomplete clock provider setup.

Fixes: 03cc105f2edf ("clk: vexpress-osc: Use the devres clock API variants")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/clk/versatile/clk-vexpress-osc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/versatile/clk-vexpress-osc.c b/drivers/clk/versatile/clk-vexpress-osc.c
index 9adbf5c33bd1..2292fee4e423 100644
--- a/drivers/clk/versatile/clk-vexpress-osc.c
+++ b/drivers/clk/versatile/clk-vexpress-osc.c
@@ -97,7 +97,10 @@ static int vexpress_osc_probe(struct platform_device *pdev)
 	if (ret < 0)
 		return ret;
 
-	devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get, &osc->hw);
+	ret = devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get, &osc->hw);
+	if (ret)
+		return ret;
+
 	clk_hw_set_rate_range(&osc->hw, osc->rate_min, osc->rate_max);
 
 	dev_dbg(&pdev->dev, "Registered clock '%s'\n", init.name);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: versatile: vexpress-osc: Check return value of devm_of_clk_add_hw_provider() in vexpress_osc_probe()
  2026-02-04  6:33 [PATCH] clk: versatile: vexpress-osc: Check return value of devm_of_clk_add_hw_provider() in vexpress_osc_probe() Chen Ni
@ 2026-02-11 12:35 ` Liviu Dudau
  0 siblings, 0 replies; 2+ messages in thread
From: Liviu Dudau @ 2026-02-11 12:35 UTC (permalink / raw)
  To: Chen Ni
  Cc: linusw, mturquette, sboyd, sudeep.holla, lpieralisi, robh, arnd,
	linux-arm-kernel, linux-clk, linux-kernel

On Wed, Feb 04, 2026 at 02:33:32PM +0800, Chen Ni wrote:
> Return the value of devm_of_clk_add_hw_provider() in order to propagate
> the error properly, if it fails due to resource allocation failure or
> device tree clock provider registration failure.
> 
> This ensures that the probe function fails safely rather than proceeding
> with a potentially incomplete clock provider setup.
> 
> Fixes: 03cc105f2edf ("clk: vexpress-osc: Use the devres clock API variants")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu

> ---
>  drivers/clk/versatile/clk-vexpress-osc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/versatile/clk-vexpress-osc.c b/drivers/clk/versatile/clk-vexpress-osc.c
> index 9adbf5c33bd1..2292fee4e423 100644
> --- a/drivers/clk/versatile/clk-vexpress-osc.c
> +++ b/drivers/clk/versatile/clk-vexpress-osc.c
> @@ -97,7 +97,10 @@ static int vexpress_osc_probe(struct platform_device *pdev)
>  	if (ret < 0)
>  		return ret;
>  
> -	devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get, &osc->hw);
> +	ret = devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_simple_get, &osc->hw);
> +	if (ret)
> +		return ret;
> +
>  	clk_hw_set_rate_range(&osc->hw, osc->rate_min, osc->rate_max);
>  
>  	dev_dbg(&pdev->dev, "Registered clock '%s'\n", init.name);
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-11 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-04  6:33 [PATCH] clk: versatile: vexpress-osc: Check return value of devm_of_clk_add_hw_provider() in vexpress_osc_probe() Chen Ni
2026-02-11 12:35 ` Liviu Dudau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox