From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Liang He <windhl@126.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Sasha Levin <sashal@kernel.org>,
magnus.damm@gmail.com, linux@armlinux.org.uk,
linux-arm-kernel@lists.infradead.org,
linux-renesas-soc@vger.kernel.org
Subject: [PATCH AUTOSEL 5.19 46/58] ARM: shmobile: rcar-gen2: Increase refcount for new reference
Date: Sun, 7 Aug 2022 21:31:04 -0400 [thread overview]
Message-ID: <20220808013118.313965-46-sashal@kernel.org> (raw)
In-Reply-To: <20220808013118.313965-1-sashal@kernel.org>
From: Liang He <windhl@126.com>
[ Upstream commit 75a185fb92e58ccd3670258d8d3b826bd2fa6d29 ]
In rcar_gen2_regulator_quirk(), for_each_matching_node_and_match() will
automatically increase and decrease the refcount. However, we should
call of_node_get() for the new reference created in 'quirk->np'.
Besides, we also should call of_node_put() before the 'quirk' being
freed.
Signed-off-by: Liang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220701121804.234223-1-windhl@126.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
index abea41f7782e..117e7b07995b 100644
--- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
@@ -125,6 +125,7 @@ static int regulator_quirk_notify(struct notifier_block *nb,
list_for_each_entry_safe(pos, tmp, &quirk_list, list) {
list_del(&pos->list);
+ of_node_put(pos->np);
kfree(pos);
}
@@ -174,11 +175,12 @@ static int __init rcar_gen2_regulator_quirk(void)
memcpy(&quirk->i2c_msg, id->data, sizeof(quirk->i2c_msg));
quirk->id = id;
- quirk->np = np;
+ quirk->np = of_node_get(np);
quirk->i2c_msg.addr = addr;
ret = of_irq_parse_one(np, 0, argsa);
if (ret) { /* Skip invalid entry and continue */
+ of_node_put(np);
kfree(quirk);
continue;
}
@@ -225,6 +227,7 @@ static int __init rcar_gen2_regulator_quirk(void)
err_mem:
list_for_each_entry_safe(pos, tmp, &quirk_list, list) {
list_del(&pos->list);
+ of_node_put(pos->np);
kfree(pos);
}
--
2.35.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-08-08 1:48 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220808013118.313965-1-sashal@kernel.org>
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 03/58] arm64: kasan: do not instrument stacktrace.c Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 04/58] arm64: stacktrace: use non-atomic __set_bit Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 05/58] arm64: kernel: drop unnecessary PoC cache clean+invalidate Sasha Levin
2022-08-08 9:05 ` Ard Biesheuvel
2022-08-09 14:01 ` Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 06/58] arm64: mm: provide idmap pointer to cpu_replace_ttbr1() Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 07/58] arm64: kaslr: defer initialization to initcall where permitted Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 08/58] arm64: Do not forget syscall when starting a new thread Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 09/58] arm64: fix oops in concurrently setting insn_emulation sysctls Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 11/58] mm: kasan: Skip unpoisoning of user pages Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 13/58] arm64: kasan: Revert "arm64: mte: reset the page tag in page->flags" Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 14/58] arm64: errata: Remove AES hwcap for COMPAT tasks Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 23/58] ARM: dts: imx6ul: add missing properties for sram Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 24/58] ARM: dts: imx6ul: change operating-points to uint32-matrix Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 25/58] ARM: dts: imx6ul: fix keypad compatible Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 26/58] ARM: dts: imx6ul: fix csi node compatible Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 27/58] ARM: dts: imx6ul: fix lcdif " Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 28/58] ARM: dts: imx6ul: fix qspi " Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 29/58] ARM: dts: BCM5301X: Add DT for Meraki MR26 Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 30/58] ARM: dts: ux500: Fix Janice accelerometer mounting matrix Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 31/58] ARM: dts: ux500: Fix Codina " Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 32/58] ARM: dts: ux500: Fix Gavini " Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 35/58] ARM: OMAP2+: display: Fix refcount leak bug Sasha Levin
2022-08-08 1:30 ` [PATCH AUTOSEL 5.19 36/58] ARM: OMAP2+: pdata-quirks: " Sasha Levin
2022-08-08 1:31 ` [PATCH AUTOSEL 5.19 45/58] arm64: dts: allwinner: a64: orangepi-win: Fix LED node name Sasha Levin
2022-08-08 1:31 ` Sasha Levin [this message]
2022-08-08 1:31 ` [PATCH AUTOSEL 5.19 49/58] PM: EM: convert power field to micro-Watts precision and align drivers Sasha Levin
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=20220808013118.313965-46-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=geert+renesas@glider.be \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=magnus.damm@gmail.com \
--cc=stable@vger.kernel.org \
--cc=windhl@126.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).