[PATCH] mtd: rawnand: pl353: fix probe resource allocation

Bastien Curutchet posted 1 patch 1 week, 6 days ago
drivers/mtd/nand/raw/pl35x-nand-controller.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] mtd: rawnand: pl353: fix probe resource allocation
Posted by Bastien Curutchet 1 week, 6 days ago
During probe(), the devm_ioremap() is called with the parent device
instead of the current one. So when the module is unloaded, the register
area isn't released.

Target the pl35x device in the devm_ioremap() instead of its parent.

Cc: stable@vger.kernel.org
Fixes: 08d8c62164a3 ("mtd: rawnand: pl353: Add support for the ARM PL353 SMC NAND controller")
Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
---
 drivers/mtd/nand/raw/pl35x-nand-controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/pl35x-nand-controller.c b/drivers/mtd/nand/raw/pl35x-nand-controller.c
index f2c65eb7a8d9..06f8f1e14b9c 100644
--- a/drivers/mtd/nand/raw/pl35x-nand-controller.c
+++ b/drivers/mtd/nand/raw/pl35x-nand-controller.c
@@ -1155,7 +1155,7 @@ static int pl35x_nand_probe(struct platform_device *pdev)
 	nfc->controller.ops = &pl35x_nandc_ops;
 	INIT_LIST_HEAD(&nfc->chips);
 
-	nfc->conf_regs = devm_ioremap_resource(&smc_amba->dev, &smc_amba->res);
+	nfc->conf_regs = devm_ioremap_resource(nfc->dev, &smc_amba->res);
 	if (IS_ERR(nfc->conf_regs))
 		return PTR_ERR(nfc->conf_regs);
 

---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260526-fix-pl35x-probe-7193bcfc7b84

Best regards,
-- 
Bastien Curutchet <bastien.curutchet@bootlin.com>
Re: [PATCH] mtd: rawnand: pl353: fix probe resource allocation
Posted by Miquel Raynal 1 week, 5 days ago
On Tue, 26 May 2026 09:10:00 +0200, Bastien Curutchet wrote:
> During probe(), the devm_ioremap() is called with the parent device
> instead of the current one. So when the module is unloaded, the register
> area isn't released.
> 
> Target the pl35x device in the devm_ioremap() instead of its parent.
> 
> 
> [...]

Applied to nand/next, thanks!

[1/1] mtd: rawnand: pl353: fix probe resource allocation
      commit: 19ed11aee966d91beebdef9d32ce926474872f79

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl