diff options
author | Liang He <windhl@126.com> | 2022-06-20 16:25:53 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-09-05 10:30:29 +0300 |
commit | 605c27f3802038e4623b6fd1bbfa021e1f65b5c4 (patch) | |
tree | a04c43ef53d0de12f9b45572dd162b7344c8ca82 /arch/powerpc/platforms/powernv/opal-powercap.c | |
parent | afa6a472a3d2a8dd477b285eeb67b3593546647b (diff) | |
download | linux-605c27f3802038e4623b6fd1bbfa021e1f65b5c4.tar.xz |
powerpc/powernv: Add missing of_node_put()s
In these driver init functions, there are two kinds of errors:
(1) missing of_put_node() for of_find_compatible_node()'s returned
pointer (refcount incremented) in fail path or when it is not
used anymore.
(2) missing of_put_node() for 'for_each_xxx' loop's break
Signed-off-by: Liang He <windhl@126.com>
[mpe: Use out_put_xxx goto label naming]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220620132553.4073863-1-windhl@126.com
Diffstat (limited to 'arch/powerpc/platforms/powernv/opal-powercap.c')
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-powercap.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/powernv/opal-powercap.c b/arch/powerpc/platforms/powernv/opal-powercap.c index 64506b46e77b..7bfe4cbeb35a 100644 --- a/arch/powerpc/platforms/powernv/opal-powercap.c +++ b/arch/powerpc/platforms/powernv/opal-powercap.c @@ -153,7 +153,7 @@ void __init opal_powercap_init(void) pcaps = kcalloc(of_get_child_count(powercap), sizeof(*pcaps), GFP_KERNEL); if (!pcaps) - return; + goto out_put_powercap; powercap_kobj = kobject_create_and_add("powercap", opal_kobj); if (!powercap_kobj) { @@ -226,6 +226,7 @@ void __init opal_powercap_init(void) } i++; } + of_node_put(powercap); return; @@ -236,6 +237,9 @@ out_pcaps_pattrs: kfree(pcaps[i].pg.name); } kobject_put(powercap_kobj); + of_node_put(node); out_pcaps: kfree(pcaps); +out_put_powercap: + of_node_put(powercap); } |