pinctrl: core: do not explicitly free on unregister
Subsystems (2)
PATCH 1/1 pinctrl: core: do not explicitly free on unregister
When using the resource managed version of pinctrl, resources might already been freed when pinctrl_unregister is called by the devres framework. When calling devm_kfree on such a already freed resource, devres prints a warning:
WARNING: CPU: 0 PID: 1 at drivers/base/devres.c:891 pinmux_generic_free_functions+0xf4/0x128 ...
Solve this by not explicitly free resources. The two affected functions (pinmux_generic_free_functions/pinctrl_generic_free_groups) are only used in pinctrl_unregister. When not using the resource managed version of pinctrl, the underlying device will presumably get freed freed soon anyway.
--- drivers/pinctrl/core.c | 1 - drivers/pinctrl/pinmux.c | 1 - 2 files changed, 2 deletions(-)
drivers/pinctrl/core.c +0 -1
@@ -702,7 +702,6 @@ static void pinctrl_generic_free_groups(struct pinctrl_dev *pctldev) group =radix_tree_lookup (&pctldev->pin_group_tree, indices[i]);radix_tree_delete (&pctldev->pin_group_tree, indices[i]); -devm_kfree (pctldev->dev, group); } pctldev->num_groups =0 ;
drivers/pinctrl/pinmux.c +0 -1
@@ -848,7 +848,6 @@ void pinmux_generic_free_functions(struct pinctrl_dev *pctldev) function =radix_tree_lookup (&pctldev->pin_function_tree, indices[i]);radix_tree_delete (&pctldev->pin_function_tree, indices[i]); -devm_kfree (pctldev->dev, function); } pctldev->num_functions =0 ;
Signature · 1 line
2.13.0
Quoted 7 lines · Stefan Agner
When using the resource managed version of pinctrl, resources might already been freed when
pinctrl_unregisteris called by the devres framework. When callingdevm_kfreeon such a already freed resource, devres prints a warning:WARNING: CPU: 0 PID: 1 at drivers/base/devres.c:891 pinmux_generic_free_functions+0xf4/0x128 ...
Quoted 7 lines
Solve this by not explicitly free resources. The two affected functions (pinmux_generic_free_functions/pinctrl_generic_free_groups) are only used in
pinctrl_unregister. When not using the resource managed version of pinctrl, the underlying device will presumably get freed freed soon anyway.Signed-off-by Stefan Agner <[email protected]>
I think this is no longer needed after the fix from Tony "pinctrl: core: Fix warning by removing bogus code"
Yours,
Linus Walleij