]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mtd: rawnand: arasan: Fix missing de-registration of NAND
authorMaciej Andrzejewski <maciej.andrzejewski@m-works.net>
Mon, 2 Dec 2024 18:58:36 +0000 (19:58 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 5 Dec 2024 10:13:52 +0000 (11:13 +0100)
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>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/arasan-nand-controller.c

index 26b506107a1a3685ad06c2f64e0e723f7a84139d..865754737f5fc7d3c0c33daca01f01ede809a784 100644 (file)
@@ -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);
 }