* [PATCH AUTOSEL 4.9 02/13] powerpc/powernv: add missing of_node_put
2022-01-17 17:07 [PATCH AUTOSEL 4.9 01/13] powerpc/6xx: add missing of_node_put Sasha Levin
@ 2022-01-17 17:07 ` Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.9 03/13] powerpc/cell: " Sasha Levin
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2022-01-17 17:07 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sasha Levin, Julia Lawall, linuxppc-dev, aneesh.kumar
From: Julia Lawall <Julia.Lawall@lip6.fr>
[ Upstream commit 7d405a939ca960162eb30c1475759cb2fdf38f8c ]
for_each_compatible_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.
A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):
// <smpl>
@@
local idexpression n;
expression e;
@@
for_each_compatible_node(n,...) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? break;
)
...
}
... when != n
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1448051604-25256-4-git-send-email-Julia.Lawall@lip6.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/platforms/powernv/opal-lpc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c
index e4169d68cb328..d28c4a9269c38 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -401,6 +401,7 @@ void opal_lpc_init(void)
if (!of_get_property(np, "primary", NULL))
continue;
opal_lpc_chip_id = of_get_ibm_chip_id(np);
+ of_node_put(np);
break;
}
if (opal_lpc_chip_id < 0)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH AUTOSEL 4.9 03/13] powerpc/cell: add missing of_node_put
2022-01-17 17:07 [PATCH AUTOSEL 4.9 01/13] powerpc/6xx: add missing of_node_put Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.9 02/13] powerpc/powernv: " Sasha Levin
@ 2022-01-17 17:07 ` Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.9 04/13] powerpc/btext: " Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.9 06/13] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING Sasha Levin
3 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2022-01-17 17:07 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Sasha Levin, Julia Lawall, linuxppc-dev
From: Julia Lawall <Julia.Lawall@lip6.fr>
[ Upstream commit a841fd009e51c8c0a8f07c942e9ab6bb48da8858 ]
for_each_node_by_name performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.
A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):
// <smpl>
@@
expression e,e1;
local idexpression n;
@@
for_each_node_by_name(n, e1) {
... when != of_node_put(n)
when != e = n
(
return n;
|
+ of_node_put(n);
? return ...;
)
...
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1448051604-25256-7-git-send-email-Julia.Lawall@lip6.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/platforms/cell/iommu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 7ff51f96a00e8..8df43781f5db9 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -1107,6 +1107,7 @@ static int __init cell_iommu_fixed_mapping_init(void)
if (hbase < dbase || (hend > (dbase + dsize))) {
pr_debug("iommu: hash window doesn't fit in"
"real DMA window\n");
+ of_node_put(np);
return -1;
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH AUTOSEL 4.9 04/13] powerpc/btext: add missing of_node_put
2022-01-17 17:07 [PATCH AUTOSEL 4.9 01/13] powerpc/6xx: add missing of_node_put Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.9 02/13] powerpc/powernv: " Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.9 03/13] powerpc/cell: " Sasha Levin
@ 2022-01-17 17:07 ` Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.9 06/13] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING Sasha Levin
3 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2022-01-17 17:07 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Sasha Levin, Julia Lawall, linuxppc-dev, nick.child
From: Julia Lawall <Julia.Lawall@lip6.fr>
[ Upstream commit a1d2b210ffa52d60acabbf7b6af3ef7e1e69cda0 ]
for_each_node_by_type performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.
A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):
// <smpl>
@@
local idexpression n;
expression e;
@@
for_each_node_by_type(n,...) {
...
(
of_node_put(n);
|
e = n
|
+ of_node_put(n);
? break;
)
...
}
... when != n
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1448051604-25256-6-git-send-email-Julia.Lawall@lip6.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/kernel/btext.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 8275858a434d9..2d91ba38b4524 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -257,8 +257,10 @@ int __init btext_find_display(int allow_nonstdout)
rc = btext_initialize(np);
printk("result: %d\n", rc);
}
- if (rc == 0)
+ if (rc == 0) {
+ of_node_put(np);
break;
+ }
}
return rc;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH AUTOSEL 4.9 06/13] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING
2022-01-17 17:07 [PATCH AUTOSEL 4.9 01/13] powerpc/6xx: add missing of_node_put Sasha Levin
` (2 preceding siblings ...)
2022-01-17 17:07 ` [PATCH AUTOSEL 4.9 04/13] powerpc/btext: " Sasha Levin
@ 2022-01-17 17:07 ` Sasha Levin
3 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2022-01-17 17:07 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sasha Levin, parth, srikar, ego, linuxppc-dev, npiggin, clg,
yukuai3, robh, valentin.schneider, hbathini
From: Michael Ellerman <mpe@ellerman.id.au>
[ Upstream commit a4ac0d249a5db80e79d573db9e4ad29354b643a8 ]
setup_profiling_timer() is only needed when CONFIG_PROFILING is enabled.
Fixes the following W=1 warning when CONFIG_PROFILING=n:
linux/arch/powerpc/kernel/smp.c:1638:5: error: no previous prototype for ‘setup_profiling_timer’
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211124093254.1054750-5-mpe@ellerman.id.au
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/powerpc/kernel/smp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 9c6f3fd580597..31675c1d678b6 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -759,10 +759,12 @@ void start_secondary(void *unused)
BUG();
}
+#ifdef CONFIG_PROFILING
int setup_profiling_timer(unsigned int multiplier)
{
return 0;
}
+#endif
#ifdef CONFIG_SCHED_SMT
/* cpumask of CPUs with asymetric SMT dependancy */
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread