From: Miaoqian Lin <linmq006@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Michal Simek <michal.simek@xilinx.com>,
Arnd Bergmann <arnd@arndb.de>, Andrew Lunn <andrew@lunn.ch>,
Miaoqian Lin <linmq006@gmail.com>,
Michael Walle <michael@walle.cc>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
YueHaibing <yuehaibing@huawei.com>,
John Linn <john.linn@xilinx.com>,
Grant Likely <grant.likely@secretlab.ca>,
Sadanand Mutyala <Sadanand.Mutyala@xilinx.com>,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] ethernet: Fix error handling in xemaclite_of_probe
Date: Tue, 8 Mar 2022 02:47:49 +0000 [thread overview]
Message-ID: <20220308024751.2320-1-linmq006@gmail.com> (raw)
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>
---
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2022-03-08 2:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-08 2:47 Miaoqian Lin [this message]
2022-03-08 13:15 ` [PATCH] ethernet: Fix error handling in xemaclite_of_probe Andrew Lunn
2022-03-09 6:20 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220308024751.2320-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=Sadanand.Mutyala@xilinx.com \
--cc=andrew@lunn.ch \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=grant.likely@secretlab.ca \
--cc=john.linn@xilinx.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@walle.cc \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).