Skip to content

Commit 5038a66

Browse files
Dan Carpenterlinusw
authored andcommitted
pinctrl: core: delete incorrect free in pinctrl_enable()
The "pctldev" struct is allocated in devm_pinctrl_register_and_init(). It's a devm_ managed pointer that is freed by devm_pinctrl_dev_release(), so freeing it in pinctrl_enable() will lead to a double free. The devm_pinctrl_dev_release() function frees the pindescs and destroys the mutex as well. Fixes: 6118714 ("pinctrl: core: Fix pinctrl_register_and_init() with pinctrl_enable()") Signed-off-by: Dan Carpenter <[email protected]> Message-ID: <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 368a90e commit 5038a66

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/pinctrl/core.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,13 +2124,7 @@ int pinctrl_enable(struct pinctrl_dev *pctldev)
21242124

21252125
error = pinctrl_claim_hogs(pctldev);
21262126
if (error) {
2127-
dev_err(pctldev->dev, "could not claim hogs: %i\n",
2128-
error);
2129-
pinctrl_free_pindescs(pctldev, pctldev->desc->pins,
2130-
pctldev->desc->npins);
2131-
mutex_destroy(&pctldev->mutex);
2132-
kfree(pctldev);
2133-
2127+
dev_err(pctldev->dev, "could not claim hogs: %i\n", error);
21342128
return error;
21352129
}
21362130

0 commit comments

Comments
 (0)