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 399/800] net: mvpp2: Put fwnode in error case during ->probe()
    Date
    From: Andy Shevchenko <andy.shevchenko@gmail.com>

    [ Upstream commit 71f0891c84dfdc448736082ab0a00acd29853896 ]

    In each iteration fwnode_for_each_available_child_node() bumps a reference
    counting of a loop variable followed by dropping in on a next iteration,

    Since in error case the loop is broken, we have to drop a reference count
    by ourselves. Do it for port_fwnode in error case during ->probe().

    Fixes: 248122212f68 ("net: mvpp2: use device_*/fwnode_* APIs instead of of_*")
    Cc: Marcin Wojtas <mw@semihalf.com>
    Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
    index d39c7639cdba..b3041fe6c0ae 100644
    --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
    +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
    @@ -7588,6 +7588,8 @@ static int mvpp2_probe(struct platform_device *pdev)
    return 0;

    err_port_probe:
    + fwnode_handle_put(port_fwnode);
    +
    i = 0;
    fwnode_for_each_available_child_node(fwnode, port_fwnode) {
    if (priv->port_list[i])
    --
    2.30.2


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