summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMiaoqian Lin <linmq006@gmail.com>2022-03-08 02:47:49 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-03-16 13:20:26 +0100
commit8609e29611befc4bfbe7a91bb50fc65ae72ff549 (patch)
tree9ffe9341cff5ebe949db717bbdc806d6e08adb0b /drivers/net
parent8078fff82254062f03d3b764e158980a7115a55a (diff)
downloadlinux-stable-8609e29611befc4bfbe7a91bb50fc65ae72ff549.tar.gz
linux-stable-8609e29611befc4bfbe7a91bb50fc65ae72ff549.tar.bz2
linux-stable-8609e29611befc4bfbe7a91bb50fc65ae72ff549.zip
ethernet: Fix error handling in xemaclite_of_probe
[ Upstream commit b19ab4b38b06aae12442b2de95ccf58b5dc53584 ] 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@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/20220308024751.2320-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_emaclite.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index edb2215f9993..23a4f9061072 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1173,7 +1173,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,
@@ -1181,6 +1181,8 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
(unsigned int __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;