lkml.org 
[lkml]   [2021]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.12 062/110] pinctrl: microchip-sgpio: Put fwnode in error case during ->probe()
    Date
    From: Andy Shevchenko <andy.shevchenko@gmail.com>

    [ Upstream commit 76b7f8fae30a9249f820e019f1e62eca992751a2 ]

    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: 7e5ea974e61c ("pinctrl: pinctrl-microchip-sgpio: Add pinctrl driver for Microsemi Serial GPIO")
    Cc: Lars Povlsen <lars.povlsen@microchip.com>
    Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Link: https://lore.kernel.org/r/20210606191940.29312-1-andy.shevchenko@gmail.com
    Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/pinctrl/pinctrl-microchip-sgpio.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
    index c12fa57ebd12..165cb7a59715 100644
    --- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
    +++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
    @@ -845,8 +845,10 @@ 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) {
    --
    2.30.2
    \
     
     \ /
      Last update: 2021-06-28 16:23    [W:5.306 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site