linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Wen Yang <wen.yang99@zte.com.cn>
Cc: linux-kernel@vger.kernel.org, wang.yi59@zte.com.cn,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH 2/5] pinctrl: rockchip: fix leaked of_node references
Date: Fri, 12 Apr 2019 10:08:25 +0200	[thread overview]
Message-ID: <4822039.BKTqNpLmcE@diego> (raw)
In-Reply-To: <1555048943-39589-3-git-send-email-wen.yang99@zte.com.cn>

Hi,

Am Freitag, 12. April 2019, 08:02:20 CEST schrieb Wen Yang:
> The call to of_parse_phandle returns a node pointer with refcount
> incremented thus it must be explicitly decremented after the last
> usage.
> 
> Detected by coccinelle with the following warnings:
> ./drivers/pinctrl/pinctrl-rockchip.c:3221:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3196, but without a corresponding object release within this function.
> ./drivers/pinctrl/pinctrl-rockchip.c:3223:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 3196, but without a corresponding object release within this function.
> 
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-rockchip@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/pinctrl/pinctrl-rockchip.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
> index 16bf21b..e22d387 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -3195,6 +3195,7 @@ static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
>  
>  		node = of_parse_phandle(bank->of_node->parent,
>  					"rockchip,pmu", 0);
> +		of_node_put(node);
>  		if (!node) {
>  			if (of_address_to_resource(bank->of_node, 1, &res)) {
>  				dev_err(info->dev, "cannot find IO resource for bank\n");
> 

hmm, the conditional does still use the node pointer, so the of_node_put
should probably be below the whole if clause?


Heiko

  reply	other threads:[~2019-04-12  8:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1555048943-39589-1-git-send-email-wen.yang99@zte.com.cn>
2019-04-12  6:02 ` [PATCH 1/5] pinctrl: pistachio: fix leaked of_node references Wen Yang
2019-04-14 13:15   ` Markus Elfring
2019-04-23 10:34   ` Linus Walleij
2019-04-12  6:02 ` [PATCH 2/5] pinctrl: rockchip: " Wen Yang
2019-04-12  8:08   ` Heiko Stübner [this message]
2019-04-12  6:02 ` [PATCH 3/5] pinctrl: st: " Wen Yang
2019-04-12  8:57   ` Patrice CHOTARD
2019-04-23  9:02   ` Linus Walleij
2019-04-12  6:02 ` [PATCH 4/5] pinctrl: samsung: " Wen Yang
2019-04-12  7:12   ` Krzysztof Kozlowski
2019-04-23  9:00   ` Linus Walleij
2019-04-12  6:02 ` [PATCH 5/5] pinctrl: zte: " Wen Yang
2019-04-16  5:56   ` Shawn Guo
2019-04-23 10:53   ` Linus Walleij
     [not found] <201904121645298604058@zte.com.cn>
2019-04-12 11:20 ` [PATCH 2/5] pinctrl: rockchip: " Heiko Stübner

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=4822039.BKTqNpLmcE@diego \
    --to=heiko@sntech.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=wang.yi59@zte.com.cn \
    --cc=wen.yang99@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 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).