* [PATCH] pinctrl: meson: Drop pinctrl_unregister for devm_ registered device
@ 2016-07-26 14:51 Wei Yongjun
2016-07-26 17:00 ` Dmitry Torokhov
2016-08-04 8:10 ` Linus Walleij
0 siblings, 2 replies; 4+ messages in thread
From: Wei Yongjun @ 2016-07-26 14:51 UTC (permalink / raw)
To: linux-arm-kernel
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/meson/pinctrl-meson.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index 11623c6..44e69c9 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -727,13 +727,7 @@ static int meson_pinctrl_probe(struct platform_device *pdev)
return PTR_ERR(pc->pcdev);
}
- ret = meson_gpiolib_register(pc);
- if (ret) {
- pinctrl_unregister(pc->pcdev);
- return ret;
- }
-
- return 0;
+ return meson_gpiolib_register(pc);
}
static struct platform_driver meson_pinctrl_driver = {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] pinctrl: meson: Drop pinctrl_unregister for devm_ registered device
2016-07-26 14:51 [PATCH] pinctrl: meson: Drop pinctrl_unregister for devm_ registered device Wei Yongjun
@ 2016-07-26 17:00 ` Dmitry Torokhov
2016-07-26 21:56 ` Kevin Hilman
2016-08-04 8:10 ` Linus Walleij
1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2016-07-26 17:00 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 26, 2016 at 02:51:58PM +0000, Wei Yongjun 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>
Fixes: e649f7ec8c5f ("pinctrl: meson: Use devm_pinctrl_register() for
pinctrl registration")
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/pinctrl/meson/pinctrl-meson.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
> index 11623c6..44e69c9 100644
> --- a/drivers/pinctrl/meson/pinctrl-meson.c
> +++ b/drivers/pinctrl/meson/pinctrl-meson.c
> @@ -727,13 +727,7 @@ static int meson_pinctrl_probe(struct platform_device *pdev)
> return PTR_ERR(pc->pcdev);
> }
>
> - ret = meson_gpiolib_register(pc);
> - if (ret) {
> - pinctrl_unregister(pc->pcdev);
> - return ret;
> - }
> -
> - return 0;
> + return meson_gpiolib_register(pc);
> }
>
> static struct platform_driver meson_pinctrl_driver = {
>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] pinctrl: meson: Drop pinctrl_unregister for devm_ registered device
2016-07-26 17:00 ` Dmitry Torokhov
@ 2016-07-26 21:56 ` Kevin Hilman
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2016-07-26 21:56 UTC (permalink / raw)
To: linux-arm-kernel
Dmitry Torokhov <dmitry.torokhov@gmail.com> writes:
> On Tue, Jul 26, 2016 at 02:51:58PM +0000, Wei Yongjun 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>
>
> Fixes: e649f7ec8c5f ("pinctrl: meson: Use devm_pinctrl_register() for
> pinctrl registration")
>
> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Kevin Hilman <khilman@baylibre.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] pinctrl: meson: Drop pinctrl_unregister for devm_ registered device
2016-07-26 14:51 [PATCH] pinctrl: meson: Drop pinctrl_unregister for devm_ registered device Wei Yongjun
2016-07-26 17:00 ` Dmitry Torokhov
@ 2016-08-04 8:10 ` Linus Walleij
1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2016-08-04 8:10 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 26, 2016 at 4:51 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 with Dmitry's and Kevin's tags.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-04 8:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-26 14:51 [PATCH] pinctrl: meson: Drop pinctrl_unregister for devm_ registered device Wei Yongjun
2016-07-26 17:00 ` Dmitry Torokhov
2016-07-26 21:56 ` Kevin Hilman
2016-08-04 8:10 ` 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).