public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
* [PATCH v1] ARM: imx31: Fix IIM mapping leak in revision check
@ 2026-05-25  4:01 Yuho Choi
  2026-06-01 19:59 ` Frank.Li
  0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-05-25  4:01 UTC (permalink / raw)
  To: Frank Li, Sascha Hauer
  Cc: Russell King, Pengutronix Kernel Team, Fabio Estevam,
	linux-arm-kernel, imx, linux-kernel, Yuho Choi

mx31_read_cpu_rev() maps the IIM registers with of_iomap() to read the
silicon revision, but returns without unmapping the MMIO mapping.

Keep the normalized revision value in a local variable and route the
return path through iounmap() after the revision register has been read.

Fixes: 3172225d45bd ("ARM: imx31: Retrieve the IIM base address from devicetree")
Signed-off-by: Yuho Choi <dbgh9129@gmail•com>
---
 arch/arm/mach-imx/cpu-imx31.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/cpu-imx31.c b/arch/arm/mach-imx/cpu-imx31.c
index 35c544924e50..e81ef9e36a1f 100644
--- a/arch/arm/mach-imx/cpu-imx31.c
+++ b/arch/arm/mach-imx/cpu-imx31.c
@@ -36,6 +36,7 @@ static int mx31_read_cpu_rev(void)
 	void __iomem *iim_base;
 	struct device_node *np;
 	u32 i, srev;
+	int rev = IMX_CHIP_REVISION_UNKNOWN;
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx31-iim");
 	iim_base = of_iomap(np, 0);
@@ -48,13 +49,17 @@ static int mx31_read_cpu_rev(void)
 
 	for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++)
 		if (srev == mx31_cpu_type[i].srev) {
+			rev = mx31_cpu_type[i].rev;
 			imx_print_silicon_rev(mx31_cpu_type[i].name,
 						mx31_cpu_type[i].rev);
-			return mx31_cpu_type[i].rev;
+			goto out;
 		}
 
 	imx_print_silicon_rev("i.MX31", IMX_CHIP_REVISION_UNKNOWN);
-	return IMX_CHIP_REVISION_UNKNOWN;
+
+out:
+	iounmap(iim_base);
+	return rev;
 }
 
 int mx31_revision(void)
-- 
2.43.0



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

* Re: [PATCH v1] ARM: imx31: Fix IIM mapping leak in revision check
  2026-05-25  4:01 [PATCH v1] ARM: imx31: Fix IIM mapping leak in revision check Yuho Choi
@ 2026-06-01 19:59 ` Frank.Li
  0 siblings, 0 replies; 2+ messages in thread
From: Frank.Li @ 2026-06-01 19:59 UTC (permalink / raw)
  To: Sascha Hauer, Yuho Choi
  Cc: Frank Li, Russell King, Pengutronix Kernel Team, Fabio Estevam,
	linux-arm-kernel, imx, linux-kernel

From: Frank Li <Frank.Li@nxp•com>


On Mon, 25 May 2026 00:01:58 -0400, Yuho Choi wrote:
> mx31_read_cpu_rev() maps the IIM registers with of_iomap() to read the
> silicon revision, but returns without unmapping the MMIO mapping.
> 
> Keep the normalized revision value in a local variable and route the
> return path through iounmap() after the revision register has been read.
> 
> 
> [...]

Applied, thanks!

[1/1] ARM: imx31: Fix IIM mapping leak in revision check
      commit: ccb4b54b8ecf1ebafef96d538cd6c5c8455bb390

Best regards,
-- 
Frank Li <Frank.Li@nxp•com>


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

end of thread, other threads:[~2026-06-01 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-25  4:01 [PATCH v1] ARM: imx31: Fix IIM mapping leak in revision check Yuho Choi
2026-06-01 19:59 ` Frank.Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox