summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
diff options
context:
space:
mode:
authorLiang He <windhl@126.com>2022-07-01 20:18:04 +0800
committerGeert Uytterhoeven <geert+renesas@glider.be>2022-07-05 09:08:35 +0200
commit75a185fb92e58ccd3670258d8d3b826bd2fa6d29 (patch)
tree3e81ee1e793858fed4968cdbc0e8f80548f694f9 /arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
parentf2906aa863381afb0015a9eb7fefad885d4e5a56 (diff)
downloadlinux-stable-75a185fb92e58ccd3670258d8d3b826bd2fa6d29.tar.gz
linux-stable-75a185fb92e58ccd3670258d8d3b826bd2fa6d29.tar.bz2
linux-stable-75a185fb92e58ccd3670258d8d3b826bd2fa6d29.zip
ARM: shmobile: rcar-gen2: Increase refcount for new reference
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>
Diffstat (limited to 'arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c')
-rw-r--r--arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c5
1 files changed, 4 insertions, 1 deletions
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 @@ remove:
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 @@ err_free:
err_mem:
list_for_each_entry_safe(pos, tmp, &quirk_list, list) {
list_del(&pos->list);
+ of_node_put(pos->np);
kfree(pos);
}