diff mbox series

[v2] mtd: rawnand: arasan: Fix missing de-registration of NAND

Message ID Z04DXNytjhFWuGFv@UBUNTU-PF54DSY0
State Accepted
Headers show
Series [v2] mtd: rawnand: arasan: Fix missing de-registration of NAND | expand

Commit Message

Maciej Andrzejewski Dec. 2, 2024, 6:58 p.m. UTC
The NAND chip-selects are registered for the Arasan driver during
initialization but are not de-registered when the driver is unloaded. As a
result, if the driver is loaded again, the chip-selects remain registered
and busy, making them unavailable for use.

Fixes: 197b88fecc50 ("mtd: rawnand: arasan: Add new Arasan NAND controller")
Cc: stable@vger.kernel.org
Signed-off-by: Maciej Andrzejewski ICEYE <maciej.andrzejewski@m-works.net>
---
 drivers/mtd/nand/raw/arasan-nand-controller.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Miquel Raynal Dec. 5, 2024, 10:43 a.m. UTC | #1
On Mon, 02 Dec 2024 19:58:36 +0100, Maciej Andrzejewski wrote:
> The NAND chip-selects are registered for the Arasan driver during
> initialization but are not de-registered when the driver is unloaded. As a
> result, if the driver is loaded again, the chip-selects remain registered
> and busy, making them unavailable for use.
> 
> 

Applied to mtd/fixes, thanks!

[1/1] mtd: rawnand: arasan: Fix missing de-registration of NAND

Patche(s) will be available within hours on:
mtd/linux.git

Kind regards,
Miquèl
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/arasan-nand-controller.c b/drivers/mtd/nand/raw/arasan-nand-controller.c
index 5436ec4a8fde..36c23fa186f2 100644
--- a/drivers/mtd/nand/raw/arasan-nand-controller.c
+++ b/drivers/mtd/nand/raw/arasan-nand-controller.c
@@ -1478,8 +1478,15 @@  static int anfc_probe(struct platform_device *pdev)
 
 static void anfc_remove(struct platform_device *pdev)
 {
+	int i;
 	struct arasan_nfc *nfc = platform_get_drvdata(pdev);
 
+	for (i = 0; i < nfc->ncs; i++) {
+		if (nfc->cs_array[i]) {
+			gpiod_put(nfc->cs_array[i]);
+		}
+	}
+
 	anfc_chips_cleanup(nfc);
 }