All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: core: Remove extra kref_get which blocks hogs being freed
@ 2020-02-28 15:41 Charles Keepax
  2020-02-28 23:33 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Keepax @ 2020-02-28 15:41 UTC (permalink / raw)
  To: linus.walleij; +Cc: tony, linux-gpio, linux-kernel, patches

kref_init starts with the reference count at 1, which will be balanced
by the pinctrl_put in pinctrl_unregister. The additional kref_get in
pinctrl_claim_hogs will increase this count to 2 and cause the hogs to
not get freed when pinctrl_unregister is called.

Fixes: 6118714275f0 ("pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 drivers/pinctrl/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 446d84fe0e31c..f23c55e221955 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -2021,7 +2021,6 @@ static int pinctrl_claim_hogs(struct pinctrl_dev *pctldev)
 		return PTR_ERR(pctldev->p);
 	}
 
-	kref_get(&pctldev->p->users);
 	pctldev->hog_default =
 		pinctrl_lookup_state(pctldev->p, PINCTRL_STATE_DEFAULT);
 	if (IS_ERR(pctldev->hog_default)) {
-- 
2.11.0


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

* Re: [PATCH] pinctrl: core: Remove extra kref_get which blocks hogs being freed
  2020-02-28 15:41 [PATCH] pinctrl: core: Remove extra kref_get which blocks hogs being freed Charles Keepax
@ 2020-02-28 23:33 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2020-02-28 23:33 UTC (permalink / raw)
  To: Charles Keepax
  Cc: ext Tony Lindgren, open list:GPIO SUBSYSTEM, linux-kernel, patches

On Fri, Feb 28, 2020 at 4:41 PM Charles Keepax
<ckeepax@opensource.cirrus.com> wrote:

> kref_init starts with the reference count at 1, which will be balanced
> by the pinctrl_put in pinctrl_unregister. The additional kref_get in
> pinctrl_claim_hogs will increase this count to 2 and cause the hogs to
> not get freed when pinctrl_unregister is called.
>
> Fixes: 6118714275f0 ("pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()")
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Patch applied for fixes.

Yours,
Linus Walleij

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

end of thread, other threads:[~2020-02-28 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28 15:41 [PATCH] pinctrl: core: Remove extra kref_get which blocks hogs being freed Charles Keepax
2020-02-28 23:33 ` 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.