From: Nishka Dasgupta <nishkadg.linux@gmail.com>
To: yisen.zhuang@huawei.com, salil.mehta@huawei.com,
davem@davemloft.net, netdev@vger.kernel.org
Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
Subject: [PATCH] net: hns: hns_enet: Add of_node_put in hns_nic_dev_probe()
Date: Thu, 15 Aug 2019 11:58:37 +0530 [thread overview]
Message-ID: <20190815062837.6015-1-nishkadg.linux@gmail.com> (raw)
The local variable ae_node in function hns_nic_dev_probe takes the
return value of of_parse_phandle, which gets a node but does not put it.
This may cause a memory leak. Hence put ae_node after the last time it
is invoked.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/net/ethernet/hisilicon/hns/hns_enet.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 2235dd55fab2..b26e84929e1e 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -2309,6 +2309,7 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
goto out_read_prop_fail;
}
priv->fwnode = &ae_node->fwnode;
+ of_node_put(ae_node);
} else if (is_acpi_node(dev->fwnode)) {
struct fwnode_reference_args args;
--
2.19.1
next reply other threads:[~2019-08-15 6:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-15 6:28 Nishka Dasgupta [this message]
2019-08-15 9:59 ` [PATCH] net: hns: hns_enet: Add of_node_put in hns_nic_dev_probe() Yonglong Liu
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=20190815062837.6015-1-nishkadg.linux@gmail.com \
--to=nishkadg.linux@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=yisen.zhuang@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).