From: Peng Zhang <zhangpeng362@huawei.com>
To: <damien.lemoal@wdc.com>, <linus.walleij@linaro.org>,
<seanga2@gmail.com>, <palmerdabbelt@google.com>
Cc: <linux-riscv@lists.infradead.org>, <linux-gpio@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <sunnanyong@huawei.com>,
<wangkefeng.wang@huawei.com>, ZhangPeng <zhangpeng362@huawei.com>
Subject: [PATCH] pinctrl: call of_node_put() when breaking out of for_each_available_child_of_node()
Date: Tue, 22 Nov 2022 07:58:53 +0000 [thread overview]
Message-ID: <20221122075853.2496680-1-zhangpeng362@huawei.com> (raw)
From: ZhangPeng <zhangpeng362@huawei.com>
Since for_each_available_child_of_node() will increase the refcount of
node, we need to call of_node_put() manually when breaking out of the
iteration.
Fixes: d4c34d09ab03 ("pinctrl: Add RISC-V Canaan Kendryte K210 FPIOA driver")
Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
---
drivers/pinctrl/pinctrl-k210.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
index ecab6bf63dc6..ad4db99094a7 100644
--- a/drivers/pinctrl/pinctrl-k210.c
+++ b/drivers/pinctrl/pinctrl-k210.c
@@ -862,8 +862,10 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
for_each_available_child_of_node(np_config, np) {
ret = k210_pinctrl_dt_subnode_to_map(pctldev, np, map,
&reserved_maps, num_maps);
- if (ret < 0)
+ if (ret < 0) {
+ of_node_put(np);
goto err;
+ }
}
return 0;
--
2.25.1
next reply other threads:[~2022-11-22 7:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 7:58 Peng Zhang [this message]
2022-11-22 7:45 ` [PATCH] pinctrl: call of_node_put() when breaking out of for_each_available_child_of_node() Damien Le Moal
2022-11-22 8:36 ` 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=20221122075853.2496680-1-zhangpeng362@huawei.com \
--to=zhangpeng362@huawei.com \
--cc=damien.lemoal@wdc.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmerdabbelt@google.com \
--cc=seanga2@gmail.com \
--cc=sunnanyong@huawei.com \
--cc=wangkefeng.wang@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).