All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MTD: nand: Fix release_mem_region() size
@ 2026-10-14  8:22 Thomas Fourier
  2026-10-14  9:23 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Fourier @ 2026-10-14  8:22 UTC (permalink / raw)
  Cc: Thomas Fourier, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Kees Cook, Manuel Lauss, Artem Bityutskiy,
	open list:NAND FLASH SUBSYSTEM, open list

In au1550nd_probe(), request_mem_region() is called with size
resource_size(r), and release_mem_region() is called in the error path
with the same size. Howeve, in the cleanup function au1550nd_remove()
calls release_mem_region() with size 0x1000.

Change release size to match request.

Fixes: b67a1a02d463 ("MTD: nand: make au1550nd.c a platform_driver")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/mtd/nand/raw/au1550nd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/au1550nd.c b/drivers/mtd/nand/raw/au1550nd.c
index f1e99197ab84..623a10dbce55 100644
--- a/drivers/mtd/nand/raw/au1550nd.c
+++ b/drivers/mtd/nand/raw/au1550nd.c
@@ -348,7 +348,7 @@ static void au1550nd_remove(struct platform_device *pdev)
 	WARN_ON(ret);
 	nand_cleanup(chip);
 	iounmap(ctx->base);
-	release_mem_region(r->start, 0x1000);
+	release_mem_region(r->start, resource_size(r));
 	kfree(ctx);
 }
 
-- 
2.53.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH] MTD: nand: Fix release_mem_region() size
  2026-10-14  8:22 [PATCH] MTD: nand: Fix release_mem_region() size Thomas Fourier
@ 2026-10-14  9:23 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2026-10-14  9:23 UTC (permalink / raw)
  To: Thomas Fourier
  Cc: Richard Weinberger, Vignesh Raghavendra, Kees Cook, Manuel Lauss,
	Artem Bityutskiy, open list:NAND FLASH SUBSYSTEM, open list

Hi Thomas,

> In au1550nd_probe(), request_mem_region() is called with size
> resource_size(r), and release_mem_region() is called in the error path
> with the same size. Howeve, in the cleanup function au1550nd_remove()
> calls release_mem_region() with size 0x1000.
>
> Change release size to match request.
>
> Fixes: b67a1a02d463 ("MTD: nand: make au1550nd.c a platform_driver")
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
> ---

This driver is very old. If you care about cleaning it up, I would
suggest doing something bigger. For instance platform_get_resource,
request_mem_region and ioremap are now a single helper named
devm_platform_ioremap_resource(). The kzalloc could also become device
managed. This will further reduce the size of the error path and the
removal.

The subject prefix btw should be updated to match today's standards (see
git log --oneline -- drivers/mtd/nand/raw/).

Do you own the hardware?

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2026-10-14  9:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14  8:22 [PATCH] MTD: nand: Fix release_mem_region() size Thomas Fourier
2026-10-14  9:23 ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.