All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: pistachio: Drop pinctrl_unregister for devm_ registered device
@ 2016-07-26 14:52 Wei Yongjun
  2016-08-04  8:11 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2016-07-26 14:52 UTC (permalink / raw
  To: Linus Walleij; +Cc: Wei Yongjun, linux-gpio

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

This is detected by Coccinelle semantic patch.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
 drivers/pinctrl/pinctrl-pistachio.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c
index c6d410e..7bad200 100644
--- a/drivers/pinctrl/pinctrl-pistachio.c
+++ b/drivers/pinctrl/pinctrl-pistachio.c
@@ -1432,7 +1432,6 @@ static int pistachio_pinctrl_probe(struct platform_device *pdev)
 {
 	struct pistachio_pinctrl *pctl;
 	struct resource *res;
-	int ret;
 
 	pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
 	if (!pctl)
@@ -1464,13 +1463,7 @@ static int pistachio_pinctrl_probe(struct platform_device *pdev)
 		return PTR_ERR(pctl->pctldev);
 	}
 
-	ret = pistachio_gpio_register(pctl);
-	if (ret < 0) {
-		pinctrl_unregister(pctl->pctldev);
-		return ret;
-	}
-
-	return 0;
+	return pistachio_gpio_register(pctl);
 }
 
 static struct platform_driver pistachio_pinctrl_driver = {


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

* Re: [PATCH] pinctrl: pistachio: Drop pinctrl_unregister for devm_ registered device
  2016-07-26 14:52 [PATCH] pinctrl: pistachio: Drop pinctrl_unregister for devm_ registered device Wei Yongjun
@ 2016-08-04  8:11 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2016-08-04  8:11 UTC (permalink / raw
  To: Wei Yongjun; +Cc: linux-gpio@vger.kernel.org

On Tue, Jul 26, 2016 at 4:52 PM, Wei Yongjun <weiyj.lk@gmail.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.
>
> This is detected by Coccinelle semantic patch.
>
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

end of thread, other threads:[~2016-08-04  8:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-26 14:52 [PATCH] pinctrl: pistachio: Drop pinctrl_unregister for devm_ registered device Wei Yongjun
2016-08-04  8:11 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.