From: Sasha Levin <sashal@kernel•org>
To: linux-kernel@vger•kernel.org, stable@vger•kernel.org
Cc: Sasha Levin <sashal@kernel•org>,
Julia Lawall <Julia.Lawall@lip6•fr>,
linuxppc-dev@lists•ozlabs.org
Subject: [PATCH AUTOSEL 4.19 04/17] powerpc/cell: add missing of_node_put
Date: Mon, 17 Jan 2022 12:05:38 -0500 [thread overview]
Message-ID: <20220117170551.1472640-4-sashal@kernel.org> (raw)
In-Reply-To: <20220117170551.1472640-1-sashal@kernel.org>
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 12352a58072ab..d9c2c4cc60be1 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -1088,6 +1088,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
next prev parent reply other threads:[~2022-01-17 17:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220117170551.1472640-1-sashal@kernel.org>
2022-01-17 17:05 ` [PATCH AUTOSEL 4.19 02/17] powerpc/6xx: add missing of_node_put Sasha Levin
2022-01-17 17:05 ` [PATCH AUTOSEL 4.19 03/17] powerpc/powernv: " Sasha Levin
2022-01-17 17:05 ` Sasha Levin [this message]
2022-01-17 17:05 ` [PATCH AUTOSEL 4.19 05/17] powerpc/btext: " Sasha Levin
2022-01-17 17:05 ` [PATCH AUTOSEL 4.19 06/17] powerpc/watchdog: Fix missed watchdog reset due to memory ordering race Sasha Levin
2022-01-17 17:05 ` [PATCH AUTOSEL 4.19 08/17] powerpc/smp: Move setup_profiling_timer() under CONFIG_PROFILING Sasha Levin
2022-01-17 17:05 ` [PATCH AUTOSEL 4.19 12/17] powerpc: handle kdump appropriately with crash_kexec_post_notifiers option Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220117170551.1472640-4-sashal@kernel.org \
--to=sashal@kernel$(echo .)org \
--cc=Julia.Lawall@lip6$(echo .)fr \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=stable@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox