We need a of_node_get() for of_find_compatible_node() to keep refcount
balance.
Signed-off-by: Liang He
---
drivers/macintosh/therm_windtunnel.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/macintosh/therm_windtunnel.c
b/drivers/macintosh/therm_windtunnel.c
index 9226b74fa08f
for_each_matching_node() will automatically increase and decrease
the refcount. As there is a reference escaped out into global
'fsl_pci_primary', we should not use of_node_put() anymore.
Fixes: 905e75c46dba ("powerpc/fsl-pci: Unify pci/pcie initialization code")
Signed-off-by
We should call of_node_put() for the reference returned by
of_parse_phandle() which will increase the refcount.
Fixes: 42d0349784c7 ("soc/fsl/qbman: Add common routine for QBMan private
allocations")
Co-authored-by: Miaoqian Lin
Signed-off-by: Liang He
---
drivers/soc/fsl/qbman/
for_each_compatible_node() will automaitically increase and decrease
the refcount of the device_node object. There is no need to call
additional of_node_get(). It is better to keep the original meaning
of refcounting as there is no any new reference created.
Signed-off-by: Liang He
---
I do
In fsl_setup_msi_irqs(), we should use of_node_put() for the
refernece 'np' returned by of_parse_phandle() which increases
the refcount.
Fixes: 895d603f945ba ("powerpc/fsl_msi: add support for the fsl, msi property
in PCI nodes")
Co-authored-by: Miaoqian Lin
Signed-off-by
for_each_node_by_type() will automatically increase and decrease
the refcount during the iteration. However, there is a reference
escaped into global 'fsl_pci_primary' and we need to handle it.
Signed-off-by: Liang He
---
arch/powerpc/platforms/85xx/ge_imp3a.c | 6 --
1 file changed, 4
In pci_add_device_node_info(), we should use of_node_put() for the
reference 'parent' returned by of_get_parent() to keep refcount
balance.
Fixes: cca87d303c85 ("powerpc/pci: Refactor pci_dn")
Co-authored-by: Miaoqian Lin
Signed-off-by: Liang He
---
arch/powerpc/kernel/pci_dn.c | 1
In ppc47x_init_irq(), we need to call of_node_put() when there is
a break during the iteration of for_each_node_with_property() which
will automatically increase and decrease the refcount.
Signed-off-by: Liang He
---
arch/powerpc/platforms/44x/ppc476.c | 1 +
1 file changed, 1 insertion
In cell_iommu_init_disabled(), we should hold the reference returned
by of_find_node_by_name() and use it to call of_node_put() for reference
balance.
Signed-off-by: Liang He
---
changelog:
v2: (1) split v1's two files in to two commits
(2) using 'check-then-put' coding style
v1: hold
(),
the refcount of 'cpu' will be automatically increased and decreased.
However, there is a reference escaped out into 'map->cpu_node' and
we should properly handle it.
Signed-off-by: Liang He
---
chagelog:
v2: (1) split v1's two files in to two commits
(2) merge all b
We should call of_node_put() for the reference 'tsi' returned by
of_get_parent() which will increase the refcount.
Signed-off-by: Liang He
---
Inserting of_node_put() in the 'if' condition is learned from Orsan:
https://lore.kernel.org/all/CA+H2tpH1hN1AJ=6vvgqxw6bz7xqdbzxdaev_oqwmnw+uxqk
At 2022-07-02 03:47:22, "Tyrel Datwyler" wrote:
>On 7/1/22 06:17, Liang He wrote:
>> In pci_add_device_node_info(), we should use of_node_put() for the
>> reference 'parent' returned by of_get_parent() to keep refcount
>> balance.
>>
>> Fixes: cca87d30
We should call of_node_put() for the reference 'tsi' returned by
of_get_parent() which will increase the refcount.
Signed-off-by: Liang He
---
changelog:
v2: use more conservative way to call of_node_put()
v1: mov 'of_node_put()' into the 'if' condition
v1 Link: https://lore.kernel.org/all
_xx in
chrp_find_bridges() function. If there is no of_node_get(), the object
maybe prematurely freed.
Signed-off-by: Liang He
---
I do not know if we should insert the of_node_put() in or out of the
spin_lock/spin_unlock. Please check it carefully.
arch/powerpc/kernel/pci-common.c | 4 ++--
1 file changed
Signed-off-by: Liang He
---
arch/powerpc/platforms/85xx/sgy_cts1000.c | 10 ++
1 file changed, 10 insertions(+)
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c
b/arch/powerpc/platforms/85xx/sgy_cts1000.c
index 98ae64075193..2a45b30852b2 100644
--- a/arch/powerpc/platforms/85xx
In mpc5121_clk_init(), of_find_compatible_node() will return a
node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/platforms/512x/clock-commonclk.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch
In ksi8560_setup_arch(), of_find_compatible_node() will return a
node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/platforms/85xx/ksi8560.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc
In media5200_init_irq(), of_find_compatible_node() will return a
node pointer with refcount incremented. We should use of_node_put()
in fail path or when it is not used anymore.
Don't worry about 'fpga_np==NULL' as of_node_put() can correctly
handle it.
Signed-off-by: Liang He
---
arch/powerpc
In gpio_halt_probe(), of_find_matching_node() will return a node pointer with
refcount incremented. We should use of_node_put() in each fail path or when it
is not used anymore.
Signed-off-by: Liang He
---
changelog:
v2: use goto-label patch style advised by Christophe.
v1: add of_node_put
At 2022-06-16 22:49:36, "Christophe Leroy" wrote:
>
>
>Le 15/06/2022 à 14:07, Liang He a écrit :
>> [You don't often get email from win...@126.com. Learn why this is important
>> at https://aka.ms/LearnAboutSenderIdentification ]
>>
>> Signed
In xive_native_init(), of_find_compatible_node() will return a
node pointer with refcount incremented. We should use of_node_put()
in each fail path or when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/sysdev/xive/native.c | 15 ++-
1 file changed, 10 insertions
2022-06-17 12:29:02,"Michael Ellerman" 写道:
>"Liang He" writes:
>> At 2022-06-17 07:37:06, "Michael Ellerman" wrote:
>>>Christophe JAILLET writes:
>>>> Le 16/06/2022 à 17:19, Liang He a écrit :
>>>>&g
At 2022-06-17 07:37:06, "Michael Ellerman" wrote:
>Christophe JAILLET writes:
>> Le 16/06/2022 à 17:19, Liang He a écrit :
>>> In gpio_halt_probe(), of_find_matching_node() will return a node pointer
>>> with
>>> refcount incremented. We shou
the of_node_put()
if there is a break.
Signed-off-by: Liang He
---
arch/powerpc/platforms/powernv/opal-powercap.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/opal-powercap.c
b/arch/powerpc/platforms/powernv/opal-powercap.c
index
At 2022-06-17 13:01:27, "Christophe JAILLET"
wrote:
>Le 17/06/2022 à 06:20, Liang He a écrit :
>> In opal_powercap_init(), of_find_compatible_node() will return
>> a node pointer with refcount incremented. We should use of_node_put()
>> in fail path
In gpio_halt_probe(), of_find_matching_node() will return a node
pointer with refcount incremented. We should use of_node_put() in
fail path or when it is not used anymore.
Signed-off-by: Liang He
---
changelog:
v4: reuse exist 'err' and use a simple code style, advised by CJ
v3: use local
In gpio_halt_probe(), of_find_matching_node() will return a node
pointer with refcount incremented. We should use of_node_put() in
fail path or when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/platforms/85xx/sgy_cts1000.c | 39 +++
1 file changed, 25
At 2022-06-17 13:37:12, "Christophe JAILLET"
wrote:
>Le 17/06/2022 à 07:22, Liang He a écrit :
>> In gpio_halt_probe(), of_find_matching_node() will return a node
>> pointer with refcount incremented. We should use of_node_put() in
>> fail path or when it is not
At 2022-06-17 07:37:06, "Michael Ellerman" wrote:
>Christophe JAILLET writes:
>> Le 16/06/2022 à 17:19, Liang He a écrit :
>>> In gpio_halt_probe(), of_find_matching_node() will return a node pointer
>>> with
>>> refcount incremented. We shou
At 2022-06-17 16:27:03, conor.doo...@microchip.com wrote:
>On 17/06/2022 09:17, Liang He wrote:
>>
>>
>>
>> At 2022-06-17 14:53:13, "Christophe Leroy"
>> wrote:
>>>
>>>
>>> Le 17/06/2022 à 08:45, Liang He a écrit :
>&
In add_pcspkr(), it is better to call of_node_put() after the
'if(!np)' check.
Signed-off-by: Liang He
---
arch/powerpc/kernel/setup-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/setup-common.c
b/arch/powerpc/kernel/setup-common.c
index
At 2022-06-17 14:28:56, "Christophe Leroy" wrote:
>
>
>Le 17/06/2022 à 08:08, Liang He a écrit :
>> In gpio_halt_probe(), of_find_matching_node() will return a node
>> pointer with refcount incremented. We should use of_node_put() in
>> fail path or when
In opal_imc_init_dev(), of_find_compatible_node() will return a
node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/platforms/powernv/opal.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc
At 2022-06-17 14:53:13, "Christophe Leroy" wrote:
>
>
>Le 17/06/2022 à 08:45, Liang He a écrit :
>>
>>
>>
>> At 2022-06-17 14:28:56, "Christophe Leroy"
>> wrote:
>>>
>>>
>>> Le 17/06/2022 à 08:08, Li
In gpio_halt_probe(), of_find_matching_node() will return a node
pointer with refcount incremented. We should use of_node_put() in
fail path or when it is not used anymore.
Signed-off-by: Liang He
---
changelog:
v5: fix 'gotot' error introduced by v4 and use cross-compiler to test
v4: reuse
At 2022-06-17 16:27:03, conor.doo...@microchip.com wrote:
>On 17/06/2022 09:17, Liang He wrote:
>>
>>
>>
>> At 2022-06-17 14:53:13, "Christophe Leroy"
>> wrote:
>>>
>>>
>>> Le 17/06/2022 à 08:45, Liang He a écrit :
>&
在 2022-06-17 18:57:36,"Christophe Leroy" 写道:
>
>
>Le 17/06/2022 à 12:47, Liang He a écrit :
>>
>>
>>
>> At 2022-06-17 16:27:03, conor.doo...@microchip.com wrote:
>>> On 17/06/2022 09:17, Liang He wrote:
>>>>
>&g
At 2022-06-17 13:01:27, "Christophe JAILLET"
wrote:
>Le 17/06/2022 à 06:20, Liang He a écrit :
>> In opal_powercap_init(), of_find_compatible_node() will return
>> a node pointer with refcount incremented. We should use of_node_put()
>> in fail path
In maple_get_boot_time(), of_find_compatible_node() will return
a node pointer with refcount incremented. We should use of_node_put()
in fail path or when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/platforms/maple/time.c | 1 +
1 file changed, 1 insertion(+)
diff --git
with the ones reported by commit-09700c504d.
Signed-off-by: Liang He
---
changelog:
v2: merge all powernv related bugs into one commit
v1: only fix bugs in opal-powercap.c
arch/powerpc/platforms/powernv/opal-powercap.c | 6 +-
arch/powerpc/platforms/powernv/opal-psr.c
In mpic_msgr_number_of_blocks() and mpic_msgr_block_number(),
of_find_node_by_name() will return a node pointer with refcount
incremented. We should use of_node_put() when it is not used
anymore.
Signed-off-by: Liang He
---
arch/powerpc/sysdev/mpic_msgr.c | 2 ++
1 file changed, 2 insertions
In init_ioports(), of_find_node_by_name() will return a node pointer
with refcount incremented. We should use of_node_put() when it is not
used anymore.
Signed-off-by: Liang He
---
arch/powerpc/platforms/8xx/tqm8xx_setup.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc
In xx_init_xx(), of_find_node_by_type() will return a node pointer
with refcount incremented. We should use of_node_put() when it is
not used anymore.
Signed-off-by: Liang He
---
v2: we merge all embedded6xx related bugs into one commit
v1: we only report the bug in holly_init_pci() of holly.c
In create_opalcore(), of_find_node_by_name() will return a node
pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/platforms/powernv/opal-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc
In pmac_cpufreq_init_MacRISC3(), we need to add corresponding
of_node_put() for the three node pointers whose refcount have
been incremented by of_find_node_by_name().
Signed-off-by: Liang He
---
drivers/cpufreq/pmac32-cpufreq.c | 4
1 file changed, 4 insertions(+)
diff --git a/drivers
In is_kdump(), we need a of_node_put() to dec the refcount which is
incremented by of_find_node_by_type().
Signed-off-by: Liang He
---
arch/powerpc/sysdev/fsl_pci.c | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev
In holly_init_pci(), of_find_node_by_type() will return a node
pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/platforms/embedded6xx/holly.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc
In soc_info(), of_find_node_by_type() will return a node pointer
with refcount incremented. We should use of_node_put() when it is
not used anymore.
Signed-off-by: Liang He
---
drivers/tty/serial/ucc_uart.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/ucc_uart.c b
In update_events_in_group(), of_find_node_by_phandle() will return
a node pointer with refcount incremented. We should use of_node_put()
in fail path or when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/perf/imc-pmu.c | 10 --
1 file changed, 8 insertions(+), 2
在 2022-06-18 15:13:13,"Christophe Leroy" 写道:
>
>
>Le 17/06/2022 à 13:26, Liang He a écrit :
>> In add_pcspkr(), it is better to call of_node_put() after the
>> 'if(!np)' check.
>
>Why is it better ?
>
>
>
>/**
> * of_node_put() - Decr
In find_legacy_serial_ports(), of_find_node_by_path() will return
a node pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/kernel/legacy_serial.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc
We should use of_node_put() for of_find_node_by_path() and
of_find_node_by_phandle() to keep refcount balance.
Signed-off-by: Liang He
---
arch/powerpc/platforms/cell/setup.c | 2 ++
arch/powerpc/platforms/cell/spu_manage.c | 2 ++
arch/powerpc/platforms/cell/spufs/inode.c | 1 +
3 files
In ibmebus_match_path(), we should use of_node_put() to keep
refcount balance.
Signed-off-by: Liang He
---
arch/powerpc/platforms/pseries/ibmebus.c | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/pseries/ibmebus.c
b/arch/powerpc/platforms/pseries
At 2022-06-18 16:48:26, "Christophe Leroy" wrote:
>
>
>Le 18/06/2022 à 10:03, Liang He a écrit :
>>
>>
>>
>>
>>
>> 在 2022-06-18 15:13:13,"Christophe Leroy" 写道:
>>>
>>>
>>> Le 17/06/202
In ls_uarts_init(), we need to add a of_node_put() to keep refcount
balance.
Signed-off-by: Liang He
---
arch/powerpc/platforms/embedded6xx/ls_uart.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c
b/arch/powerpc/platforms/embedded6xx
At 2022-06-18 16:48:26, "Christophe Leroy" wrote:
>
>
>Le 18/06/2022 à 10:03, Liang He a écrit :
>>
>>
>>
>>
>>
>> 在 2022-06-18 15:13:13,"Christophe Leroy" 写道:
>>>
>>>
>>> Le 17/06/202
In pnv_parse_cpuidle_dt(), of_find_node_by_path() will return a node
pointer with refcount incremented. We should use of_node_put() in fail
path or when it is not used anymore.
Signed-off-by: Liang He
---
arch/powerpc/platforms/powernv/idle.c | 1 +
1 file changed, 1 insertion(+)
diff --git
We need add corresponding of_node_put() to keep refcount balance
in sysdev.
Signed-off-by: Liang He
---
changelog:
v2: (1) merge all sysdev related bug into one commit
(2) find new bugs in spapr.c and mpic_msgr.c
v1: find missing of_node_put() in each file
arch/powerpc/sysdev
with the ones reported by commit-09700c504d.
Signed-off-by: Liang He
---
changelog:
v3: merge more refcount bugs into one commit
v2: merge opal-*.c
v1: send mising of_node_put patch for each file
arch/powerpc/platforms/powernv/idle.c | 1 +
arch/powerpc/platforms/powernv
In smp_core99_setup(), we need to add of_node_put() to keep refcount
balance.
Signed-off-by: Liang He
---
arch/powerpc/platforms/powermac/smp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/powermac/smp.c
b/arch/powerpc/platforms/powermac/smp.c
index d9df45741ece
In pas_pci_init(), we need one of_node_put() for of_find_node_by_path()
to keep refcount balance.
Signed-off-by: Liang He
---
arch/powerpc/platforms/pasemi/pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/pasemi/pci.c
b/arch/powerpc/platforms/pasemi/pci.c
index
At 2022-06-20 19:11:33, "Christophe Leroy" wrote:
>Hi,
>
>Le 20/06/2022 à 11:23, Liang He a écrit :
>>
>> Hi, Christophe.
>>
>> Sorry to trobule you again.
>>
>> Now I have found other bugs in same directories (i.e., arch/powerpc/sysde
In mpc832x_spi_init(), we should hold the reference returned by
of_find_compatible_node() and use it to call of_node_put() for
refcount balance.
Signed-off-by: Liang He
---
arch/powerpc/platforms/83xx/mpc832x_rdb.c | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch
In cell_iommu_init_disabled() and cbe_get_be_node(), we need to
hold the reference returned by of_find_node_by_xxx APIs and use
it to call of_node_put() for refcount balance.
Signed-off-by: Liang He
---
arch/powerpc/platforms/cell/cbe_regs.c | 10 --
arch/powerpc/platforms/cell/iommu.c
In mpc5121_clk_provide_migration_support(), we need to hold the
reference returned by of_find_compatible_node() and use it to call
of_node_put for refcount balance.
Signed-off-by: Liang He
---
arch/powerpc/platforms/512x/clock-commonclk.c | 6 --
1 file changed, 4 insertions(+), 2 deletions
In pseries_cpuhp_cache_use_count() and pseries_cpuhp_detach_nodes(),
we need carefully hold the reference returned by
of_find_next_cache_node() and use it to call of_node_put() to keep
refcount balance.
Signed-off-by: Liang He
---
arch/powerpc/platforms/pseries/hotplug-cpu.c | 15
creation.
Fixes: 51d3082fe6e5 ("[PATCH] powerpc: Unify udbg (#2)")
Signed-off-by: Liang He
---
commit-51d3082fe6e5 first introduces the 'of_find_node_by_name' which
involved the refcounting bug.
arch/powerpc/platforms/powermac/feature.c | 15 ++-
1 file changed, 10 insert
We should call of_node_put() for the reference 'gparent' escaped
out of the for_each_child_of_node() as it has increased the refcount.
Fixes: 5b9ca526917b ("[PATCH] 3/5 powerpc: Add platform functions interpreter")
Signed-off-by: Liang He
---
arch/powerpc/platforms/powermac/pfunc_
We should call of_node_put() for the reference 'parent' returned by
of_get_parent() which has increased the refcount.
Fixes: 730745a5c450 ("[PATCH] 1/5 powerpc: Rework PowerMac i2c part 1")
Signed-off-by: Liang He
---
arch/powerpc/platforms/powermac/low_i2c.c | 1 +
1 file changed, 1
During the iteration of for_each_child_of_node(), we need to call
of_node_put() for the old references stored in to 'ch_def' and 'ch_a'
as their refcounters have been increased in last iteration.
Fixes: 51d3082fe6e5 ("[PATCH] powerpc: Unify udbg (#2)")
Signed-off-by: Liang He
---
ar
In fsl_pci_assign_primary(), we should remove the of_node_put()
when breaking out of the for_each_matching_node() as the 'np'
is escaped out by global 'fsl_pci_primary'.
Fixes: 905e75c46dba ("powerpc/fsl-pci: Unify pci/pcie initialization code")
Signed-off-by: Liang He
---
arch/powe
At 2022-09-05 11:25:38, "Michael Ellerman" wrote:
>Liang He writes:
>> We should call of_node_put() for the reference 'tsi' returned by
>> of_get_parent() which will increase the refcount.
>>
>> Signed-off-by: Liang He
>> ---
>> change
At 2022-08-02 12:51:08, "Benjamin Herrenschmidt"
wrote:
>On Sat, 2022-07-16 at 15:31 +0800, Liang He wrote:
>> We should call of_node_put() for the reference 'gparent' escaped
>> out of the for_each_child_of_node() as it has increased the refcount.
>
>Sam
In ucc_uart_probe(), we have added proper of_node_put() in the failure
paths. However, we miss it before we free *qe_port* in the remove() function.
Signed-off-by: Liang He
---
drivers/tty/serial/ucc_uart.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/serial/ucc_uart.c b
t;)
Signed-off-by: Liang He
---
arch/powerpc/sysdev/mpc5xxx_clocks.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/mpc5xxx_clocks.c
b/arch/powerpc/sysdev/mpc5xxx_clocks.c
index c5bf7e1b3780..58cee28e2399 100644
--- a/arch/powerpc/sysdev/mpc5xxx_clocks.c
We call of_node_get() in wf_sat_probe() after sat is created,
so we need the of_node_put() before *kfree(sat)*.
Fixes: ac171c46667c ("[PATCH] powerpc: Thermal control for dual core G5s")
Signed-off-by: Liang He
---
drivers/macintosh/windfarm_smu_sat.c | 1 +
1 file changed, 1 insertio
76 matches
Mail list logo