linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.4 01/12] powerpc/6xx: add missing of_node_put
@ 2022-01-17 17:07 Sasha Levin
  2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 02/12] powerpc/powernv: " Sasha Levin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sasha Levin @ 2022-01-17 17:07 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, nick.child, maz, Julia Lawall, linuxppc-dev

From: Julia Lawall <Julia.Lawall@lip6.fr>

[ Upstream commit f6e82647ff71d427d4148964b71f239fba9d7937 ]

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>
@@
expression e;
local idexpression n;
@@

@@
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-2-git-send-email-Julia.Lawall@lip6.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
index 9485f1024d46c..b3bcdce89c3bb 100644
--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
@@ -220,6 +220,7 @@ void hlwd_pic_probe(void)
 			irq_set_chained_handler(cascade_virq,
 						hlwd_pic_irq_cascade);
 			hlwd_irq_host = host;
+			of_node_put(np);
 			break;
 		}
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH AUTOSEL 4.4 02/12] powerpc/powernv: add missing of_node_put
  2022-01-17 17:07 [PATCH AUTOSEL 4.4 01/12] powerpc/6xx: add missing of_node_put Sasha Levin
@ 2022-01-17 17:07 ` Sasha Levin
  2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 03/12] 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.4 03/12] powerpc/cell: add missing of_node_put
  2022-01-17 17:07 [PATCH AUTOSEL 4.4 01/12] powerpc/6xx: add missing of_node_put Sasha Levin
  2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 02/12] powerpc/powernv: " Sasha Levin
@ 2022-01-17 17:07 ` Sasha Levin
  2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 04/12] powerpc/btext: " Sasha Levin
  2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 06/12] 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 14a582b212745..4edceff5791ad 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.4 04/12] powerpc/btext: add missing of_node_put
  2022-01-17 17:07 [PATCH AUTOSEL 4.4 01/12] powerpc/6xx: add missing of_node_put Sasha Levin
  2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 02/12] powerpc/powernv: " Sasha Levin
  2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 03/12] powerpc/cell: " Sasha Levin
@ 2022-01-17 17:07 ` Sasha Levin
  2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 06/12] 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 41c011cb60706..8d05ef26dea9d 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.4 06/12] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING
  2022-01-17 17:07 [PATCH AUTOSEL 4.4 01/12] powerpc/6xx: add missing of_node_put Sasha Levin
                   ` (2 preceding siblings ...)
  2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 04/12] 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, ego, srikar, parth, 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 ec9ec2058d2d3..19ba60ab18073 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -732,10 +732,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

end of thread, other threads:[~2022-01-17 17:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 17:07 [PATCH AUTOSEL 4.4 01/12] powerpc/6xx: add missing of_node_put Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 02/12] powerpc/powernv: " Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 03/12] powerpc/cell: " Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 04/12] powerpc/btext: " Sasha Levin
2022-01-17 17:07 ` [PATCH AUTOSEL 4.4 06/12] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).