Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: core: Remove extra kref_get which blocks hogs being freed

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>
Link: https://lore.kernel.org/r/20200228154142.13860-1-ckeepax@opensource.cirrus.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Charles Keepax and committed by
Linus Walleij
aafd56fc 4c48e549

-1
-1
drivers/pinctrl/core.c
··· 2021 2021 return PTR_ERR(pctldev->p); 2022 2022 } 2023 2023 2024 - kref_get(&pctldev->p->users); 2025 2024 pctldev->hog_default = 2026 2025 pinctrl_lookup_state(pctldev->p, PINCTRL_STATE_DEFAULT); 2027 2026 if (IS_ERR(pctldev->hog_default)) {