Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH] pinctrl: renesas: rzn1: Use devm_clk_get_enabled() in rzn1_pinctrl_probe()
@ 2026-11-23 13:04 Markus Elfring
  2026-11-23 13:10 ` sashiko-bot
  2026-11-23 13:12 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Markus Elfring @ 2026-11-23 13:04 UTC (permalink / raw)
  To: linux-renesas-soc, linux-gpio, Geert Uytterhoeven, Linus Walleij
  Cc: LKML, kernel-janitors, Andy Shevchenko, Christophe Jaillet,
	Florian Fainelli, Frank Li, Michal Simek

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 23 Nov 2026 13:56:29 +0100

* Reuse existing functionality from devm_clk_get_enabled() instead of
  keeping duplicate source code.

* Delete a clk_disable_unprepare() call on an error handling path
  and in the implementation of the function “rzn1_pinctrl_remove”.

* Omit the label “err_clk”.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pinctrl/renesas/pinctrl-rzn1.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/pinctrl/renesas/pinctrl-rzn1.c
index d8422d740433..a6dfcd4e31ae 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
@@ -869,12 +869,9 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev)
 		return PTR_ERR(ipctl->lev2);
 	ipctl->lev2_protect_phys = (u32)res->start + 0x400;
 
-	ipctl->clk = devm_clk_get(&pdev->dev, NULL);
+	ipctl->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(ipctl->clk))
 		return PTR_ERR(ipctl->clk);
-	ret = clk_prepare_enable(ipctl->clk);
-	if (ret)
-		return ret;
 
 	ipctl->dev = &pdev->dev;
 	rzn1_pinctrl_desc.name = dev_name(&pdev->dev);
@@ -882,7 +879,7 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev)
 	ret = rzn1_pinctrl_probe_dt(pdev, ipctl);
 	if (ret) {
 		dev_err(&pdev->dev, "fail to probe dt properties\n");
-		goto err_clk;
+		return ret;
 	}
 
 	platform_set_drvdata(pdev, ipctl);
@@ -891,28 +888,20 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev)
 					     ipctl, &ipctl->pctl);
 	if (ret) {
 		dev_err(&pdev->dev, "could not register rzn1 pinctrl driver\n");
-		goto err_clk;
+		return ret;
 	}
 
 	ret = pinctrl_enable(ipctl->pctl);
 	if (ret)
-		goto err_clk;
+		return ret;
 
 	dev_info(&pdev->dev, "probed\n");
 
 	return 0;
-
-err_clk:
-	clk_disable_unprepare(ipctl->clk);
-
-	return ret;
 }
 
 static void rzn1_pinctrl_remove(struct platform_device *pdev)
 {
-	struct rzn1_pinctrl *ipctl = platform_get_drvdata(pdev);
-
-	clk_disable_unprepare(ipctl->clk);
 }
 
 static const struct of_device_id rzn1_pinctrl_match[] = {
-- 
2.56.1


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

* Re: [PATCH] pinctrl: renesas: rzn1: Use devm_clk_get_enabled() in rzn1_pinctrl_probe()
  2026-11-23 13:04 [PATCH] pinctrl: renesas: rzn1: Use devm_clk_get_enabled() in rzn1_pinctrl_probe() Markus Elfring
@ 2026-11-23 13:10 ` sashiko-bot
  2026-11-23 13:12 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-23 13:10 UTC (permalink / raw)
  To: Markus Elfring, linux-gpio; +Cc: wsa+renesas

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] pinctrl: renesas: rzn1: empty rzn1_pinctrl_remove() and unused
  clk field
--

commit b6f0acc93a9de8539ec8710ba4e37529bd3b8bed
Author: Markus Elfring <elfring@users.sourceforge.net>

pinctrl: renesas: rzn1: Use devm_clk_get_enabled() in rzn1_pinctrl_probe()

This commit converts rzn1_pinctrl_probe() to use devm_clk_get_enabled()
and drops the manual clk_disable_unprepare() calls on error and removal.

> diff --git a/drivers/pinctrl/renesas/pinctrl-rzn1.c b/drivers/pinctrl/renesas/pinctrl-rzn1.c
> index 64a89e307191a..1addd76da642f 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c
> @@ -875,12 +875,9 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev)
>  		return PTR_ERR(ipctl->lev2);
>  	ipctl->lev2_protect_phys = (u32)res->start + 0x400;
>  
> -	ipctl->clk = devm_clk_get(&pdev->dev, NULL);
> +	ipctl->clk = devm_clk_get_enabled(&pdev->dev, NULL);
>  	if (IS_ERR(ipctl->clk))
>  		return PTR_ERR(ipctl->clk);
> -	ret = clk_prepare_enable(ipctl->clk);
> -	if (ret)
> -		return ret;
>  
>  	ipctl->dev = &pdev->dev;
>  	rzn1_pinctrl_desc.name = dev_name(&pdev->dev);
> @@ -888,7 +885,7 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev)
>  	ret = rzn1_pinctrl_probe_dt(pdev, ipctl);
>  	if (ret) {
>  		dev_err(&pdev->dev, "fail to probe dt properties\n");
> -		goto err_clk;
> +		return ret;
>  	}
>  
>  	platform_set_drvdata(pdev, ipctl);
> @@ -897,28 +894,20 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev)
>  					     ipctl, &ipctl->pctl);
>  	if (ret) {
>  		dev_err(&pdev->dev, "could not register rzn1 pinctrl driver\n");
> -		goto err_clk;
> +		return ret;
>  	}
>  
>  	ret = pinctrl_enable(ipctl->pctl);
>  	if (ret)
> -		goto err_clk;
> +		return ret;
>  
>  	dev_info(&pdev->dev, "probed\n");
>  
>  	return 0;
> -
> -err_clk:
> -	clk_disable_unprepare(ipctl->clk);
> -
> -	return ret;
>  }
>  
>  static void rzn1_pinctrl_remove(struct platform_device *pdev)
>  {
> -	struct rzn1_pinctrl *ipctl = platform_get_drvdata(pdev);
> -
> -	clk_disable_unprepare(ipctl->clk);
>  }

[Severity: Low]
Can rzn1_pinctrl_remove() and its .remove assignment in
rzn1_pinctrl_driver be dropped now that the function is empty?

With rzn1_pinctrl_remove() gone, ipctl->clk is no longer read outside
rzn1_pinctrl_probe() and platform_get_drvdata() has no remaining callers,
so struct rzn1_pinctrl.clk and the platform_set_drvdata() call in
rzn1_pinctrl_probe() can also be removed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/e05bd9db-c855-4972-86bb-3b7346cdd278@web.de?part=1

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

* Re: [PATCH] pinctrl: renesas: rzn1: Use devm_clk_get_enabled() in rzn1_pinctrl_probe()
  2026-11-23 13:04 [PATCH] pinctrl: renesas: rzn1: Use devm_clk_get_enabled() in rzn1_pinctrl_probe() Markus Elfring
  2026-11-23 13:10 ` sashiko-bot
@ 2026-11-23 13:12 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2026-11-23 13:12 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-renesas-soc, linux-gpio, Geert Uytterhoeven, Linus Walleij,
	LKML, kernel-janitors, Andy Shevchenko, Christophe Jaillet,
	Florian Fainelli, Frank Li, Michal Simek


> >  static void rzn1_pinctrl_remove(struct platform_device *pdev)
> >  {
> > -	struct rzn1_pinctrl *ipctl = platform_get_drvdata(pdev);
> > -
> > -	clk_disable_unprepare(ipctl->clk);
> >  }
> 
> [Severity: Low]
> Can rzn1_pinctrl_remove() and its .remove assignment in
> rzn1_pinctrl_driver be dropped now that the function is empty?
> 
> With rzn1_pinctrl_remove() gone, ipctl->clk is no longer read outside
> rzn1_pinctrl_probe() and platform_get_drvdata() has no remaining callers,
> so struct rzn1_pinctrl.clk and the platform_set_drvdata() call in
> rzn1_pinctrl_probe() can also be removed.

Ack. Please update.


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 13:04 [PATCH] pinctrl: renesas: rzn1: Use devm_clk_get_enabled() in rzn1_pinctrl_probe() Markus Elfring
2026-11-23 13:10 ` sashiko-bot
2026-11-23 13:12 ` Wolfram Sang

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