[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220308024751.2320-1-linmq006@gmail.com>
Date: Tue, 8 Mar 2022 02:47:49 +0000
From: Miaoqian Lin <linmq006@...il.com>
To: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Michal Simek <michal.simek@...inx.com>,
Arnd Bergmann <arnd@...db.de>, Andrew Lunn <andrew@...n.ch>,
Miaoqian Lin <linmq006@...il.com>,
Michael Walle <michael@...le.cc>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
YueHaibing <yuehaibing@...wei.com>,
John Linn <john.linn@...inx.com>,
Grant Likely <grant.likely@...retlab.ca>,
Sadanand Mutyala <Sadanand.Mutyala@...inx.com>,
netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] ethernet: Fix error handling in xemaclite_of_probe
This node pointer is returned by of_parse_phandle() with refcount
incremented in this function. Calling of_node_put() to avoid the
refcount leak. As the remove function do.
Fixes: 5cdaaa12866e ("net: emaclite: adding MDIO and phy lib support")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 519599480b15..77fa2cb03aca 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1183,7 +1183,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
if (rc) {
dev_err(dev,
"Cannot register network device, aborting\n");
- goto error;
+ goto put_node;
}
dev_info(dev,
@@ -1191,6 +1191,8 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
(unsigned long __force)ndev->mem_start, lp->base_addr, ndev->irq);
return 0;
+put_node:
+ of_node_put(lp->phy_node);
error:
free_netdev(ndev);
return rc;
--
2.17.1
Powered by blists - more mailing lists