linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: s2mps11: Check of_clk_add_hw_provider() result
@ 2024-04-01 10:38 Aleksandr Aprelkov
  2024-04-01 12:06 ` Christophe JAILLET
  2024-04-01 14:40 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 3+ messages in thread
From: Aleksandr Aprelkov @ 2024-04-01 10:38 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Aleksandr Aprelkov, Michael Turquette, Stephen Boyd, linux-kernel,
	linux-samsung-soc, linux-clk, lvc-project

There is no check if error occurs in clock provider registration.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: b228fad50c00 ("clk: s2mps11: Migrate to clk_hw based OF and registration APIs")
Signed-off-by: Aleksandr Aprelkov <aaprelkov@usergate.com>
---
 drivers/clk/clk-s2mps11.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
index 38c456540d1b..f9ce413b6c02 100644
--- a/drivers/clk/clk-s2mps11.c
+++ b/drivers/clk/clk-s2mps11.c
@@ -187,8 +187,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 	}
 
 	clk_data->num = S2MPS11_CLKS_NUM;
-	of_clk_add_hw_provider(s2mps11_clks->clk_np, of_clk_hw_onecell_get,
+	ret = of_clk_add_hw_provider(s2mps11_clks->clk_np, of_clk_hw_onecell_get,
 			       clk_data);
+	if (ret < 0)
+		goto err_reg;
 
 	platform_set_drvdata(pdev, s2mps11_clks);
 
-- 
2.34.1


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

* Re: [PATCH] clk: s2mps11: Check of_clk_add_hw_provider() result
  2024-04-01 10:38 [PATCH] clk: s2mps11: Check of_clk_add_hw_provider() result Aleksandr Aprelkov
@ 2024-04-01 12:06 ` Christophe JAILLET
  2024-04-01 14:40 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2024-04-01 12:06 UTC (permalink / raw)
  To: Aleksandr Aprelkov, Krzysztof Kozlowski
  Cc: Michael Turquette, Stephen Boyd, linux-kernel, linux-samsung-soc,
	linux-clk, lvc-project

Le 01/04/2024 à 12:38, Aleksandr Aprelkov a écrit :
> There is no check if error occurs in clock provider registration.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: b228fad50c00 ("clk: s2mps11: Migrate to clk_hw based OF and registration APIs")
> Signed-off-by: Aleksandr Aprelkov <aaprelkov@usergate.com>
> ---
>   drivers/clk/clk-s2mps11.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
> index 38c456540d1b..f9ce413b6c02 100644
> --- a/drivers/clk/clk-s2mps11.c
> +++ b/drivers/clk/clk-s2mps11.c
> @@ -187,8 +187,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
>   	}
>   
>   	clk_data->num = S2MPS11_CLKS_NUM;
> -	of_clk_add_hw_provider(s2mps11_clks->clk_np, of_clk_hw_onecell_get,
> +	ret = of_clk_add_hw_provider(s2mps11_clks->clk_np, of_clk_hw_onecell_get,
>   			       clk_data);

Hi,

Nit: "clk_data);" is wrongly aligned now.

CJ

> +	if (ret < 0)
> +		goto err_reg;
>   
>   	platform_set_drvdata(pdev, s2mps11_clks);
>   


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

* Re: [PATCH] clk: s2mps11: Check of_clk_add_hw_provider() result
  2024-04-01 10:38 [PATCH] clk: s2mps11: Check of_clk_add_hw_provider() result Aleksandr Aprelkov
  2024-04-01 12:06 ` Christophe JAILLET
@ 2024-04-01 14:40 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-01 14:40 UTC (permalink / raw)
  To: Aleksandr Aprelkov
  Cc: Michael Turquette, Stephen Boyd, linux-kernel, linux-samsung-soc,
	linux-clk, lvc-project

On 01/04/2024 12:38, Aleksandr Aprelkov wrote:
> There is no check if error occurs in clock provider registration.

No, instead explain why there should be a check.

> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: b228fad50c00 ("clk: s2mps11: Migrate to clk_hw based OF and registration APIs")
> Signed-off-by: Aleksandr Aprelkov <aaprelkov@usergate.com>
> ---
>  drivers/clk/clk-s2mps11.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
> index 38c456540d1b..f9ce413b6c02 100644
> --- a/drivers/clk/clk-s2mps11.c
> +++ b/drivers/clk/clk-s2mps11.c
> @@ -187,8 +187,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
>  	}
>  
>  	clk_data->num = S2MPS11_CLKS_NUM;
> -	of_clk_add_hw_provider(s2mps11_clks->clk_np, of_clk_hw_onecell_get,
> +	ret = of_clk_add_hw_provider(s2mps11_clks->clk_np, of_clk_hw_onecell_get,
>  			       clk_data);
> +	if (ret < 0)
> +		goto err_reg;

I really do not understand why you are doing this. This SVACE in the
past was creating really fake reports and we were complaining multiple
times that you should fix your tool.

NAK for such explanation.

Best regards,
Krzysztof


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

end of thread, other threads:[~2024-04-01 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-01 10:38 [PATCH] clk: s2mps11: Check of_clk_add_hw_provider() result Aleksandr Aprelkov
2024-04-01 12:06 ` Christophe JAILLET
2024-04-01 14:40 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).