From: Johan Hovold <johan@kernel.org>
To: cgel.zte@gmail.com
Cc: dinguyen@kernel.org, linux-kernel@vger.kernel.org,
Minghao Chi <chi.minghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] firmware: Avoid leak OF node on error
Date: Mon, 23 May 2022 13:55:07 +0200 [thread overview]
Message-ID: <Yot2G7k8ICec77Rf@hovoldconsulting.com> (raw)
In-Reply-To: <20220523111323.3183-1-chi.minghao@zte.com.cn>
On Mon, May 23, 2022 at 11:13:23AM +0000, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> The OF node should be put before returning error in stratix10_svc_init(),
> otherwise node's refcount will be leaked.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
> drivers/firmware/stratix10-svc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
> index 14663f671323..3facd5dfb617 100644
> --- a/drivers/firmware/stratix10-svc.c
> +++ b/drivers/firmware/stratix10-svc.c
> @@ -1109,10 +1109,10 @@ static int __init stratix10_svc_init(void)
> return -ENODEV;
>
> np = of_find_matching_node(fw_np, stratix10_svc_drv_match);
> + of_node_put(np);
> if (!np)
> return -ENODEV;
>
> - of_node_put(np);
> ret = of_platform_populate(fw_np, stratix10_svc_drv_match, NULL, NULL);
> if (ret)
> return ret;
NAK, please just stop
prev parent reply other threads:[~2022-05-23 11:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 11:13 [PATCH] firmware: Avoid leak OF node on error cgel.zte
2022-05-23 11:55 ` Johan Hovold [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=Yot2G7k8ICec77Rf@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=cgel.zte@gmail.com \
--cc=chi.minghao@zte.com.cn \
--cc=dinguyen@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zealci@zte.com.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.