lkml.org 
[lkml]   [2021]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.13 657/800] leds: lm36274: Put fwnode in error case during ->probe()
    Date
    From: Andy Shevchenko <andy.shevchenko@gmail.com>

    [ Upstream commit 3c5f655c44bb65cb7e3c219d08c130ce5fa45d7f ]

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

    In the older code the same is implied with device_for_each_child_node().

    Fixes: 11e1bbc116a7 ("leds: lm36274: Introduce the TI LM36274 LED driver")
    Fixes: a448fcf19c9c ("leds: lm36274: don't iterate through children since there is only one")
    Cc: Dan Murphy <dmurphy@ti.com>
    Cc: Marek Behún <marek.behun@nic.cz>
    Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: Pavel Machek <pavel@ucw.cz>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/leds/leds-lm36274.c | 1 +
    1 file changed, 1 insertion(+)

    diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c
    index aadb03468a40..a23a9424c2f3 100644
    --- a/drivers/leds/leds-lm36274.c
    +++ b/drivers/leds/leds-lm36274.c
    @@ -127,6 +127,7 @@ static int lm36274_probe(struct platform_device *pdev)

    ret = lm36274_init(chip);
    if (ret) {
    + fwnode_handle_put(init_data.fwnode);
    dev_err(chip->dev, "Failed to init the device\n");
    return ret;
    }
    --
    2.30.2


    \
     
     \ /
      Last update: 2021-07-12 11:10    [W:4.025 / U:0.280 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site