[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211124084048.175456-1-yangyingliang@huawei.com>
Date: Wed, 24 Nov 2021 16:40:48 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>
CC: <gerhard@...leder-embedded.com>, <kuba@...nel.org>,
<davem@...emloft.net>
Subject: [PATCH -next] tsnep: Add missing of_node_put() in tsnep_mdio_init()
The node pointer is returned by of_get_child_by_name() with
refcount incremented in tsnep_mdio_init(). Calling of_node_put()
to aovid the refcount leak in tsnep_mdio_init().
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/net/ethernet/engleder/tsnep_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
index 8333313dd706..d7d436d6aed2 100644
--- a/drivers/net/ethernet/engleder/tsnep_main.c
+++ b/drivers/net/ethernet/engleder/tsnep_main.c
@@ -1089,9 +1089,10 @@ static int tsnep_mdio_init(struct tsnep_adapter *adapter)
adapter->mdiobus->phy_mask = 0x0000001;
retval = of_mdiobus_register(adapter->mdiobus, np);
+
+out:
if (np)
of_node_put(np);
-out:
return retval;
}
--
2.25.1
Powered by blists - more mailing lists