[PATCH] macintosh: Add missing of_node_get() in do_attach()

2022-06-22 Thread Liang He
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

[PATCH] powerpc: fsl: pci: Remove of_node_put() in fsl_pci_assign_primary()

2022-07-05 Thread Liang He
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

[PATCH] soc: fsl: qbman: Fix missing of_node_put() in qbman_init_private_mem()

2022-07-04 Thread Liang He
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/

[PATCH] powerpc: fsl: gtm: Remove of_node_get() in fsl_gtm_init()

2022-07-04 Thread Liang He
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

[PATCH] powerpc: sysdev: fsl_msi: Add missing of_node_put() for of_parse_phandle()

2022-07-04 Thread Liang He
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

[PATCH] powerpc: 85xx: Fix refcount bugs in ge_imp3a_pci_assign_primary()

2022-07-01 Thread Liang He
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

[PATCH] powerpc: kernel: pci_dn: Add missing of_node_put() for of_get_xx API

2022-07-01 Thread Liang He
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

[PATCH] powerpc: 44x: Add of_node_put() when break out from for_each

2022-07-01 Thread Liang He
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

[PATCH v2 2/2] powerpc: cell: iommu: Hold reference returned by of_find_node_by_name()

2022-07-01 Thread Liang He
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

[PATCH v2 1/2] powerpc: cell: cbe_regs: Fix refcount bugs

2022-07-01 Thread Liang He
(), 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

[PATCH] powerpc: kernel: Fix missing of_node_put() in add_legacy_soc_port()

2022-07-01 Thread Liang He
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

Re:Re: [PATCH] powerpc: kernel: pci_dn: Add missing of_node_put() for of_get_xx API

2022-07-01 Thread Liang He
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

[PATCH v2] powerpc: kernel: legacy_serial: Fix missing of_node_put() in add_legacy_soc_port()

2022-07-01 Thread Liang He
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

[PATCH] powerpc: kernel: pci-common: Fix refcount bug for 'phb->dn'

2022-07-01 Thread Liang He
_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

[PATCH] arch: powerpc: platforms: 85xx: Add missing of_node_put in sgy_cts1000.c

2022-06-15 Thread Liang He
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

[PATCH] arch: powerpc: platforms: 512x: Add missing of_node_put()

2022-06-15 Thread Liang He
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

[PATCH] arch: powerpc: platforms: 85xx: Fix refcount leak bug in ksi8560.c

2022-06-16 Thread Liang He
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

[PATCH] powerpc: platforms: 52xx: Fix refcount leak in media5200.c

2022-06-16 Thread Liang He
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

[PATCH v2] arch: powerpc: platforms: 85xx: Add missing of_node_put in sgy_cts1000.c

2022-06-16 Thread Liang He
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

Re:Re: [PATCH] arch: powerpc: platforms: 85xx: Add missing of_node_put in sgy_cts1000.c

2022-06-16 Thread Liang He
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

[PATCH] powerpc: sysdev: xive: Fix refcount leak in native.c

2022-06-16 Thread Liang He
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

Re:Re:Re: [PATCH v2] arch: powerpc: platforms: 85xx: Add missing of_node_put in sgy_cts1000.c

2022-06-16 Thread Liang He
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

Re:Re: [PATCH v2] arch: powerpc: platforms: 85xx: Add missing of_node_put in sgy_cts1000.c

2022-06-16 Thread Liang He
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

[PATCH] powerpc: powernv: Fix refcount leak bug in opal-powercap

2022-06-16 Thread Liang He
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

Re:Re: [PATCH] powerpc: powernv: Fix refcount leak bug in opal-powercap

2022-06-16 Thread Liang He
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

[PATCH v4] powerpc:85xx: Add missing of_node_put() in sgy_cst1000

2022-06-17 Thread Liang He
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

[PATCH v3] powerpc:85xx: Add missing of_node_put() in sgy_cst1000

2022-06-16 Thread Liang He
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

Re:Re: [PATCH v3] powerpc:85xx: Add missing of_node_put() in sgy_cst1000

2022-06-16 Thread Liang He
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

Re:Re: [PATCH v2] arch: powerpc: platforms: 85xx: Add missing of_node_put in sgy_cts1000.c

2022-06-16 Thread Liang He
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

Re:Re: [PATCH v4] powerpc:85xx: Add missing of_node_put() in sgy_cst1000

2022-06-17 Thread Liang He
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 : >&

[PATCH] powerpc: kernel: Change the order of of_node_put()

2022-06-17 Thread Liang He
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

Re:Re: [PATCH v4] powerpc:85xx: Add missing of_node_put() in sgy_cst1000

2022-06-17 Thread Liang He
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

[PATCH] powerpc: powernv: Fix refcount leak in opal

2022-06-17 Thread Liang He
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

Re:Re: [PATCH v4] powerpc:85xx: Add missing of_node_put() in sgy_cst1000

2022-06-17 Thread Liang He
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

[PATCH v5] powerpc:85xx: Add missing of_node_put() in sgy_cst1000

2022-06-17 Thread Liang He
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

Re:Re: [PATCH v4] powerpc:85xx: Add missing of_node_put() in sgy_cst1000

2022-06-17 Thread Liang He
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 : >&

Re:Re: [PATCH v4] powerpc:85xx: Add missing of_node_put() in sgy_cst1000

2022-06-17 Thread Liang He
在 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

Re:Re: [PATCH] powerpc: powernv: Fix refcount leak bug in opal-powercap

2022-06-17 Thread Liang He
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

[PATCH] powerpc: maple: Fix refcount leak bug in time.c

2022-06-17 Thread Liang He
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

[PATCH v2] powerpc: powernv: Fix refcount leak bug

2022-06-17 Thread Liang He
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

[PATCH] powerpc: sysdev: Fix refcount leak bug in mpic_msgr

2022-06-17 Thread Liang He
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

[PATCH] powerpc: 8xx: Fix refcount leak bug in tqm8xx_setup

2022-06-17 Thread Liang He
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

[PATCH v2] powerpc: embedded6xx: Fix refcount leak bugs

2022-06-17 Thread Liang He
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

[PATCH] powerpc: powernv: opal-core: Fix refcount leak bug

2022-06-17 Thread Liang He
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

[PATCH] cpufreq: pmac32-cpufreq: Fix refcount leak bug

2022-06-17 Thread Liang He
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

[PATCH] powerpc: sysdev: Fix refcount leak bug in fsl_pci.c

2022-06-17 Thread Liang He
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

[PATCH] powerpc: embedded6xx: Fix refcount leak bug in holly.c

2022-06-17 Thread Liang He
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

[PATCH] tty: serial: Fix refcount leak bug in ucc_uart.c

2022-06-18 Thread Liang He
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

[PATCH] powerpc: perf: Fix refcount leak bug in imc-pmu.c

2022-06-18 Thread Liang He
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

Re:Re: [PATCH] powerpc: kernel: Change the order of of_node_put()

2022-06-18 Thread Liang He
在 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

[PATCH] powerpc: kernel: Fix refcount bug in legacy_serial.c

2022-06-19 Thread Liang He
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

[PATCH] powerpc/cell: Fix refcount leak bugs

2022-06-19 Thread Liang He
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

[PATCH] powerpc: pseries: Fix refcount bug in ibmebus

2022-06-19 Thread Liang He
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

Re:Re: [PATCH] powerpc: kernel: Change the order of of_node_put()

2022-06-18 Thread Liang He
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

[PATCH] powerpc/embedded6xx/ls_uart: Add missing of_node_put()

2022-06-20 Thread Liang He
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

Re:Re: [PATCH] powerpc: kernel: Change the order of of_node_put()

2022-06-20 Thread Liang He
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

[PATCH] powerpc/powernv: Fix refcount leak bug in idle.c

2022-06-20 Thread Liang He
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

[PATCH v2] powerpc/sysdev: Fix refcount leak bugs

2022-06-20 Thread Liang He
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

[PATCH v3] powerpc/powernv: Fix refcount leak bugs

2022-06-20 Thread Liang He
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

[PATCH] powerpc/powermac: Fix refcount leak bug

2022-06-20 Thread Liang He
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

[PATCH] powerpc/pasemi: Fix refcount leak bug

2022-06-20 Thread Liang He
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

Re:Re: [PATCH] powerpc: kernel: Change the order of of_node_put()

2022-06-20 Thread Liang He
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

[PATCH] powerpc/83xx: Hold the reference returned by of_find_compatible_node

2022-06-21 Thread Liang He
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

[PATCH] powerpc/cell: Hold reference returned by of_find_node_by_xxx APIs

2022-06-21 Thread Liang He
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

[PATCH] powerpc/512x: Hold the reference returned by of_find_compatible_node

2022-06-21 Thread Liang He
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

[PATCH] powerpc/pseries: Hold reference and fix refcount leak bugs

2022-06-21 Thread Liang He
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

[PATCH] powerpc/powermac/feature: Fix refcount leak bug

2022-07-16 Thread Liang He
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

[PATCH] powerpc/powermac/pfunc_base: Fix refcount leak bug in macio_gpio_init_one()

2022-07-16 Thread Liang He
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_

[PATCH] powerpc/powermac/low_i2c: Fix refcount leak bug in kw_i2c_probe()

2022-07-16 Thread Liang He
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

[PATCH] powerpc/powermac/udbg_scc: Fix refcount leak bug in udbg_scc_init()

2022-07-16 Thread Liang He
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

[PATCH] powerpc/fsl_pci: Remove of_node_put() when reference escaped out

2022-07-20 Thread Liang He
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

Re:Re: [PATCH v2] powerpc: kernel: legacy_serial: Fix missing of_node_put() in add_legacy_soc_port()

2022-09-05 Thread Liang He
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

Re:Re: [PATCH] powerpc/powermac/pfunc_base: Fix refcount leak bug in macio_gpio_init_one()

2022-08-13 Thread Liang He
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

[PATCH] serial: ucc_uart: Add of_node_put() in ucc_uart_remove()

2022-12-05 Thread Liang He
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

[PATCH] powerpc/mpc5xxx: Add missing fwnode_handle_put()

2023-03-21 Thread Liang He
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

[PATCH] macintosh/windfarm_smu_sat: Add missing of_node_put()

2023-03-29 Thread Liang He
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