From: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
To: Wei Yongjun <weiyj.lk@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, linux-gpio@vger.kernel.org
Subject: Re: [PATCH -next] gpio: of: add missing of_node_put() in of_gpiochip_scan_gpios()
Date: Sat, 29 Oct 2016 21:14:54 +0300 [thread overview]
Message-ID: <effbe05c-264e-5176-e37f-c27bafd1d7cf@mentor.com> (raw)
In-Reply-To: <1477757632-26746-1-git-send-email-weiyj.lk@gmail.com>
On 10/29/2016 07:13 PM, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> When terminating for_each_available_child_of_node() iteration
> with break or return, of_node_put() should be used to prevent
> stale device node references from being left behind.
>
> This is detected by Coccinelle semantic patch.
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
> ---
> drivers/gpio/gpiolib-of.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index b46be18..92b185f 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -251,8 +251,10 @@ static int of_gpiochip_scan_gpios(struct gpio_chip *chip)
> continue;
>
> ret = gpiod_hog(desc, name, lflags, dflags);
> - if (ret < 0)
> + if (ret < 0) {
> + of_node_put(np);
> return ret;
> + }
> }
>
> return 0;
>
--
With best wishes,
Vladimir
next prev parent reply other threads:[~2016-10-29 18:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-29 16:13 [PATCH -next] gpio: of: add missing of_node_put() in of_gpiochip_scan_gpios() Wei Yongjun
2016-10-29 18:14 ` Vladimir Zapolskiy [this message]
2016-10-31 8:23 ` Linus Walleij
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=effbe05c-264e-5176-e37f-c27bafd1d7cf@mentor.com \
--to=vladimir_zapolskiy@mentor.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=weiyj.lk@gmail.com \
--cc=weiyongjun1@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).