LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] pinctrl: zynqmp: Drop pinctrl_unregister for devm_ registered device
@ 2021-07-29  7:19 Yang Yingliang
  2021-08-06  7:45 ` Michal Simek
  2021-08-11 13:09 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2021-07-29  7:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: linus.walleij, michal.simek, lakshmi.sai.krishna.potthuri

It's not necessary to unregister pin controller device registered
with devm_pinctrl_register() and using pinctrl_unregister() leads
to a double free.

Fixes: fa99e7013827 ("pinctrl: zynqmp: some code cleanups")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/pinctrl/pinctrl-zynqmp.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c
index bbde676b7313..e14012209992 100644
--- a/drivers/pinctrl/pinctrl-zynqmp.c
+++ b/drivers/pinctrl/pinctrl-zynqmp.c
@@ -866,15 +866,6 @@ static int zynqmp_pinctrl_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int zynqmp_pinctrl_remove(struct platform_device *pdev)
-{
-	struct zynqmp_pinctrl *pctrl = platform_get_drvdata(pdev);
-
-	pinctrl_unregister(pctrl->pctrl);
-
-	return 0;
-}
-
 static const struct of_device_id zynqmp_pinctrl_of_match[] = {
 	{ .compatible = "xlnx,zynqmp-pinctrl" },
 	{ }
@@ -887,7 +878,6 @@ static struct platform_driver zynqmp_pinctrl_driver = {
 		.of_match_table = zynqmp_pinctrl_of_match,
 	},
 	.probe = zynqmp_pinctrl_probe,
-	.remove = zynqmp_pinctrl_remove,
 };
 module_platform_driver(zynqmp_pinctrl_driver);
 
-- 
2.25.1


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

* Re: [PATCH] pinctrl: zynqmp: Drop pinctrl_unregister for devm_ registered device
  2021-07-29  7:19 [PATCH] pinctrl: zynqmp: Drop pinctrl_unregister for devm_ registered device Yang Yingliang
@ 2021-08-06  7:45 ` Michal Simek
  2021-08-11 13:09 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2021-08-06  7:45 UTC (permalink / raw)
  To: Yang Yingliang, linux-kernel
  Cc: linus.walleij, michal.simek, lakshmi.sai.krishna.potthuri



On 7/29/21 9:19 AM, Yang Yingliang wrote:
> It's not necessary to unregister pin controller device registered
> with devm_pinctrl_register() and using pinctrl_unregister() leads
> to a double free.
> 
> Fixes: fa99e7013827 ("pinctrl: zynqmp: some code cleanups")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/pinctrl/pinctrl-zynqmp.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c
> index bbde676b7313..e14012209992 100644
> --- a/drivers/pinctrl/pinctrl-zynqmp.c
> +++ b/drivers/pinctrl/pinctrl-zynqmp.c
> @@ -866,15 +866,6 @@ static int zynqmp_pinctrl_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int zynqmp_pinctrl_remove(struct platform_device *pdev)
> -{
> -	struct zynqmp_pinctrl *pctrl = platform_get_drvdata(pdev);
> -
> -	pinctrl_unregister(pctrl->pctrl);
> -
> -	return 0;
> -}
> -
>  static const struct of_device_id zynqmp_pinctrl_of_match[] = {
>  	{ .compatible = "xlnx,zynqmp-pinctrl" },
>  	{ }
> @@ -887,7 +878,6 @@ static struct platform_driver zynqmp_pinctrl_driver = {
>  		.of_match_table = zynqmp_pinctrl_of_match,
>  	},
>  	.probe = zynqmp_pinctrl_probe,
> -	.remove = zynqmp_pinctrl_remove,
>  };
>  module_platform_driver(zynqmp_pinctrl_driver);
>  
>

Reviewed-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal


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

* Re: [PATCH] pinctrl: zynqmp: Drop pinctrl_unregister for devm_ registered device
  2021-07-29  7:19 [PATCH] pinctrl: zynqmp: Drop pinctrl_unregister for devm_ registered device Yang Yingliang
  2021-08-06  7:45 ` Michal Simek
@ 2021-08-11 13:09 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2021-08-11 13:09 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, Michal Simek, Sai Krishna Potthuri

On Thu, Jul 29, 2021 at 9:12 AM Yang Yingliang <yangyingliang@huawei.com> wrote:

> It's not necessary to unregister pin controller device registered
> with devm_pinctrl_register() and using pinctrl_unregister() leads
> to a double free.
>
> Fixes: fa99e7013827 ("pinctrl: zynqmp: some code cleanups")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Patch applied!

Yours,
Linus Walleij

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

end of thread, other threads:[~2021-08-11 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  7:19 [PATCH] pinctrl: zynqmp: Drop pinctrl_unregister for devm_ registered device Yang Yingliang
2021-08-06  7:45 ` Michal Simek
2021-08-11 13:09 ` Linus Walleij

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).