Commit 76b7f8fa authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Linus Walleij

pinctrl: microchip-sgpio: Put fwnode in error case during ->probe()

device_for_each_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.

Fixes: 7e5ea974 ("pinctrl: pinctrl-microchip-sgpio: Add pinctrl driver for Microsemi Serial GPIO")
Cc: Lars Povlsen <lars.povlsen@microchip.com>
Signed-off-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20210606191940.29312-1-andy.shevchenko@gmail.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 009c9aa5
......@@ -845,9 +845,11 @@ static int microchip_sgpio_probe(struct platform_device *pdev)
i = 0;
device_for_each_child_node(dev, fwnode) {
ret = microchip_sgpio_register_bank(dev, priv, fwnode, i++);
if (ret)
if (ret) {
fwnode_handle_put(fwnode);
return ret;
}
}
if (priv->in.gpio.ngpio != priv->out.gpio.ngpio) {
dev_err(dev, "Banks must have same GPIO count\n");
......
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