From: Jakub Kicinski <kuba@kernel.org>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<grygorii.strashko@ti.com>, <davem@davemloft.net>
Subject: Re: [PATCH] net: cpsw: add missing of_node_put() in cpsw_probe_dt()
Date: Thu, 28 Apr 2022 09:52:07 -0700 [thread overview]
Message-ID: <20220428095207.6a8ce4ed@kernel.org> (raw)
In-Reply-To: <20220428014514.2509940-1-yangyingliang@huawei.com>
On Thu, 28 Apr 2022 09:45:14 +0800 Yang Yingliang wrote:
> If devm_kcalloc() fails, 'tmp_node' should be put in cpsw_probe_dt().
>
> Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Why does the error path (the err_node_put label)
not put the tmp_node reference either?
> diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
> index bd4b1528cf99..b81179f7d738 100644
> --- a/drivers/net/ethernet/ti/cpsw_new.c
> +++ b/drivers/net/ethernet/ti/cpsw_new.c
> @@ -1246,8 +1246,10 @@ static int cpsw_probe_dt(struct cpsw_common *cpsw)
> data->slave_data = devm_kcalloc(dev, CPSW_SLAVE_PORTS_NUM,
> sizeof(struct cpsw_slave_data),
> GFP_KERNEL);
> - if (!data->slave_data)
> + if (!data->slave_data) {
> + of_node_put(tmp_node);
> return -ENOMEM;
> + }
>
> /* Populate all the child nodes here...
> */
prev parent reply other threads:[~2022-04-28 16:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 1:45 [PATCH] net: cpsw: add missing of_node_put() in cpsw_probe_dt() Yang Yingliang
2022-04-28 16:52 ` Jakub Kicinski [this message]
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=20220428095207.6a8ce4ed@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=grygorii.strashko@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yangyingliang@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).