Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()'
@ 2020-05-30 20:49 Christophe JAILLET
  2020-06-01 10:16 ` Aisheng Dong
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Christophe JAILLET @ 2020-05-30 20:49 UTC (permalink / raw)
  To: aisheng.dong, festevam, shawnguo, stefan, kernel, linus.walleij,
	s.hauer, linux-imx, gary.bisson
  Cc: linux-gpio, Christophe JAILLET, kernel-janitors, linux-kernel,
	linux-arm-kernel

'pinctrl_unregister()' should not be called to undo
'devm_pinctrl_register_and_init()', it is already handled by the framework.

This simplifies the error handling paths of the probe function.
The 'imx_free_resources()' can be removed as well.

Fixes: a51c158bf0f7 ("pinctrl: imx: use radix trees for groups and functions")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/pinctrl/freescale/pinctrl-imx.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 9f42036c5fbb..1f81569c7ae3 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -774,16 +774,6 @@ static int imx_pinctrl_probe_dt(struct platform_device *pdev,
 	return 0;
 }
 
-/*
- * imx_free_resources() - free memory used by this driver
- * @info: info driver instance
- */
-static void imx_free_resources(struct imx_pinctrl *ipctl)
-{
-	if (ipctl->pctl)
-		pinctrl_unregister(ipctl->pctl);
-}
-
 int imx_pinctrl_probe(struct platform_device *pdev,
 		      const struct imx_pinctrl_soc_info *info)
 {
@@ -874,23 +864,18 @@ int imx_pinctrl_probe(struct platform_device *pdev,
 					     &ipctl->pctl);
 	if (ret) {
 		dev_err(&pdev->dev, "could not register IMX pinctrl driver\n");
-		goto free;
+		return ret;
 	}
 
 	ret = imx_pinctrl_probe_dt(pdev, ipctl);
 	if (ret) {
 		dev_err(&pdev->dev, "fail to probe dt properties\n");
-		goto free;
+		return ret;
 	}
 
 	dev_info(&pdev->dev, "initialized IMX pinctrl driver\n");
 
 	return pinctrl_enable(ipctl->pctl);
-
-free:
-	imx_free_resources(ipctl);
-
-	return ret;
 }
 
 static int __maybe_unused imx_pinctrl_suspend(struct device *dev)
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* RE: [PATCH] pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()'
  2020-05-30 20:49 [PATCH] pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()' Christophe JAILLET
@ 2020-06-01 10:16 ` Aisheng Dong
  2020-06-02 10:13 ` Dan Carpenter
  2020-06-03 12:34 ` Linus Walleij
  2 siblings, 0 replies; 5+ messages in thread
From: Aisheng Dong @ 2020-06-01 10:16 UTC (permalink / raw)
  To: Christophe JAILLET, festevam, shawnguo, stefan, kernel,
	linus.walleij, s.hauer, dl-linux-imx, Gary Bisson
  Cc: linux-gpio, kernel-janitors, linux-kernel, linux-arm-kernel

> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Sent: Sunday, May 31, 2020 4:50 AM
> 
> 'pinctrl_unregister()' should not be called to undo
> 'devm_pinctrl_register_and_init()', it is already handled by the framework.
> 
> This simplifies the error handling paths of the probe function.
> The 'imx_free_resources()' can be removed as well.
> 
> Fixes: a51c158bf0f7 ("pinctrl: imx: use radix trees for groups and functions")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>

Regards
Aisheng
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()'
  2020-05-30 20:49 [PATCH] pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()' Christophe JAILLET
  2020-06-01 10:16 ` Aisheng Dong
@ 2020-06-02 10:13 ` Dan Carpenter
  2020-06-02 20:08   ` Christophe JAILLET
  2020-06-03 12:34 ` Linus Walleij
  2 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2020-06-02 10:13 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: aisheng.dong, festevam, linus.walleij, kernel-janitors,
	linux-kernel, stefan, gary.bisson, linux-gpio, linux-imx, kernel,
	shawnguo, s.hauer, linux-arm-kernel

On Sat, May 30, 2020 at 10:49:55PM +0200, Christophe JAILLET wrote:
> 'pinctrl_unregister()' should not be called to undo
> 'devm_pinctrl_register_and_init()', it is already handled by the framework.
> 
> This simplifies the error handling paths of the probe function.
> The 'imx_free_resources()' can be removed as well.
> 
> Fixes: a51c158bf0f7 ("pinctrl: imx: use radix trees for groups and functions")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---

You didn't introduce this but the:

	ipctl->input_sel_base = of_iomap(np, 0);

should be changed to devm_of_iomap().

regards,
dan carpenter


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()'
  2020-06-02 10:13 ` Dan Carpenter
@ 2020-06-02 20:08   ` Christophe JAILLET
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2020-06-02 20:08 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: aisheng.dong, shawnguo, linus.walleij, kernel-janitors,
	linux-kernel, stefan, gary.bisson, linux-gpio, linux-imx, kernel,
	festevam, s.hauer, linux-arm-kernel

Le 02/06/2020 à 12:13, Dan Carpenter a écrit :
> On Sat, May 30, 2020 at 10:49:55PM +0200, Christophe JAILLET wrote:
>> 'pinctrl_unregister()' should not be called to undo
>> 'devm_pinctrl_register_and_init()', it is already handled by the framework.
>>
>> This simplifies the error handling paths of the probe function.
>> The 'imx_free_resources()' can be removed as well.
>>
>> Fixes: a51c158bf0f7 ("pinctrl: imx: use radix trees for groups and functions")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
> You didn't introduce this but the:
>
> 	ipctl->input_sel_base = of_iomap(np, 0);
>
> should be changed to devm_of_iomap().
Done as a separated patch.

Thx for the review and the comment.


CJ

> regards,
> dan carpenter



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()'
  2020-05-30 20:49 [PATCH] pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()' Christophe JAILLET
  2020-06-01 10:16 ` Aisheng Dong
  2020-06-02 10:13 ` Dan Carpenter
@ 2020-06-03 12:34 ` Linus Walleij
  2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2020-06-03 12:34 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Dong Aisheng, Fabio Estevam, Sascha Hauer, kernel-janitors,
	linux-kernel, Stefan Agner, Gary Bisson,
	open list:GPIO SUBSYSTEM, NXP Linux Team, Sascha Hauer,
	Shawn Guo, Linux ARM

On Sat, May 30, 2020 at 10:49 PM Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:

> 'pinctrl_unregister()' should not be called to undo
> 'devm_pinctrl_register_and_init()', it is already handled by the framework.
>
> This simplifies the error handling paths of the probe function.
> The 'imx_free_resources()' can be removed as well.
>
> Fixes: a51c158bf0f7 ("pinctrl: imx: use radix trees for groups and functions")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Patch applied!

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-30 20:49 [PATCH] pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()' Christophe JAILLET
2020-06-01 10:16 ` Aisheng Dong
2020-06-02 10:13 ` Dan Carpenter
2020-06-02 20:08   ` Christophe JAILLET
2020-06-03 12:34 ` Linus Walleij

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git