Commit 8ada020a authored by Yang Yingliang's avatar Yang Yingliang Committed by Linus Walleij

pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe()

Using devm_add_action_or_reset() to make workqueue device-managed, so it can be
destroy whenever the driver is unbound.

Fixes: c297561b ("pinctrl: ocelot: Fix interrupt controller")
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Link: https://lore.kernel.org/r/20220925021258.1492905-1-yangyingliang@huawei.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent afb8d5f4
......@@ -2038,6 +2038,11 @@ static struct regmap *ocelot_pinctrl_create_pincfg(struct platform_device *pdev,
return devm_regmap_init_mmio(&pdev->dev, base, &regmap_config);
}
static void ocelot_destroy_workqueue(void *data)
{
destroy_workqueue(data);
}
static int ocelot_pinctrl_probe(struct platform_device *pdev)
{
const struct ocelot_match_data *data;
......@@ -2069,6 +2074,11 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
if (!info->wq)
return -ENOMEM;
ret = devm_add_action_or_reset(dev, ocelot_destroy_workqueue,
info->wq);
if (ret)
return ret;
info->pincfg_data = &data->pincfg_data;
reset = devm_reset_control_get_optional_shared(dev, "switch");
......@@ -2110,15 +2120,6 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
return 0;
}
static int ocelot_pinctrl_remove(struct platform_device *pdev)
{
struct ocelot_pinctrl *info = platform_get_drvdata(pdev);
destroy_workqueue(info->wq);
return 0;
}
static struct platform_driver ocelot_pinctrl_driver = {
.driver = {
.name = "pinctrl-ocelot",
......@@ -2126,7 +2127,6 @@ static struct platform_driver ocelot_pinctrl_driver = {
.suppress_bind_attrs = true,
},
.probe = ocelot_pinctrl_probe,
.remove = ocelot_pinctrl_remove,
};
module_platform_driver(ocelot_pinctrl_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment