netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<ioana.ciornei@nxp.com>, <davem@davemloft.net>,
	<robert-ionut.alexa@nxp.com>
Subject: Re: [PATCH] net: dpaa2-mac: add missing of_node_put() in dpaa2_mac_get_node()
Date: Fri, 29 Apr 2022 19:29:50 -0700	[thread overview]
Message-ID: <20220429192950.5a1d23cc@kernel.org> (raw)
In-Reply-To: <20220428100127.542399-1-yangyingliang@huawei.com>

On Thu, 28 Apr 2022 18:01:27 +0800 Yang Yingliang wrote:
> Add missing of_node_put() in error path in dpaa2_mac_get_node().
> 
> Fixes: 5b1e38c0792c ("dpaa2-mac: bail if the dpmacs fwnode is not found")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
> index c48811d3bcd5..a91446685526 100644
> --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
> +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
> @@ -108,8 +108,11 @@ static struct fwnode_handle *dpaa2_mac_get_node(struct device *dev,
>  		return ERR_PTR(-EPROBE_DEFER);
>  	}
>  
> -	if (!parent)
> +	if (!parent) {
> +		if (dpmacs)
> +			of_node_put(dpmacs);

of_node_put() accepts NULL. I know this because unlike you I did 
at least the bare minimum looking at the surrounding code and saw 
other places not checking if it's NULL.

  reply	other threads:[~2022-04-30  2:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 10:01 [PATCH] net: dpaa2-mac: add missing of_node_put() in dpaa2_mac_get_node() Yang Yingliang
2022-04-30  2:29 ` Jakub Kicinski [this message]
2022-05-05  1:30   ` Yang Yingliang

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=20220429192950.5a1d23cc@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=ioana.ciornei@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robert-ionut.alexa@nxp.com \
    --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).