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,
jiabing.wan@qq.com
Subject: Re: [PATCH] hwmon: (nct7802) Add of_node_put() before return
Date: Thu, 28 Oct 2021 21:28:12 -0700 [thread overview]
Message-ID: <20211029042812.GA818647@roeck-us.net> (raw)
In-Reply-To: <20211029024918.5161-1-wanjiabing@vivo.com>
On Thu, Oct 28, 2021 at 10:49:18PM -0400, Wan Jiabing wrote:
> Fix following coccicheck warning:
> ./drivers/hwmon/nct7802.c:1152:2-24: 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/nct7802.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c
> index d56f78327619..d1eeef02b6dc 100644
> --- a/drivers/hwmon/nct7802.c
> +++ b/drivers/hwmon/nct7802.c
> @@ -1152,8 +1152,10 @@ static int nct7802_configure_channels(struct device *dev,
> for_each_child_of_node(dev->of_node, node) {
> err = nct7802_get_channel_config(dev, node, &mode_mask,
> &mode_val);
> - if (err)
> + if (err) {
> + of_node_put(node);
> return err;
> + }
> }
> }
>
prev parent reply other threads:[~2021-10-29 4:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 2:49 [PATCH] hwmon: (nct7802) Add of_node_put() before return Wan Jiabing
2021-10-29 4:28 ` 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=20211029042812.GA818647@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=jiabing.wan@qq.com \
--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