ethernet: Fix error handling in xemaclite_of_probe
[ Upstream commitb19ab4b38b] 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:5cdaaa1286("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>
This commit is contained in:
parent
506d61bc1b
commit
979b418b96
1 changed files with 3 additions and 1 deletions
|
|
@ -1187,7 +1187,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,
|
||||
|
|
@ -1195,6 +1195,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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue