From: Guenter Roeck <linux@roeck-us.net>
To: Wan Jiabing <wanjiabing@vivo.com>
Cc: Jean Delvare <jdelvare@suse.com>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
kael_w@yeah.net
Subject: Re: [PATCH] hwmon: (tmp421) Add of_node_put() before return
Date: Mon, 18 Oct 2021 07:24:21 -0700 [thread overview]
Message-ID: <20211018142421.GA1151312@roeck-us.net> (raw)
In-Reply-To: <20211018121538.16482-1-wanjiabing@vivo.com>
On Mon, Oct 18, 2021 at 08:15:37AM -0400, Wan Jiabing wrote:
> Fix following coccicheck warning:
> ./drivers/hwmon/tmp421.c:416:1-23: WARNING: Function
> for_each_child_of_node should have of_node_put() before return.
>
> Early exits from for_each_child_of_node should decrement the
> node reference counter.
>
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Applied.
Thanks,
Guenter
> ---
> drivers/hwmon/tmp421.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c
> index 31e95b5749c8..1fd8d41d90c8 100644
> --- a/drivers/hwmon/tmp421.c
> +++ b/drivers/hwmon/tmp421.c
> @@ -418,8 +418,10 @@ static int tmp421_probe_from_dt(struct i2c_client *client, struct tmp421_data *d
> continue;
>
> err = tmp421_probe_child_from_dt(client, child, data);
> - if (err)
> + if (err) {
> + of_node_put(child);
> return err;
> + }
> }
>
> return 0;
prev parent reply other threads:[~2021-10-18 14:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 12:15 [PATCH] hwmon: (tmp421) Add of_node_put() before return Wan Jiabing
2021-10-18 14:24 ` Guenter Roeck [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=20211018142421.GA1151312@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=kael_w@yeah.net \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wanjiabing@vivo.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