diff mbox series

[08/62] mtd: rawnand: cs553x: Stop using nand_release()

Message ID 20200510121220.18042-9-miquel.raynal@bootlin.com
State Changes Requested
Delegated to: Miquel Raynal
Headers show
Series mtd: rawnand: Get rid of nand_release() | expand

Commit Message

Miquel Raynal May 10, 2020, 12:11 p.m. UTC
This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().

Let's stop using nand_release() by calling mtd_device_unregister() and
nand_cleanup() directly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/raw/cs553x_nand.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/cs553x_nand.c b/drivers/mtd/nand/raw/cs553x_nand.c
index e2322cee3229..98f13e4c634c 100644
--- a/drivers/mtd/nand/raw/cs553x_nand.c
+++ b/drivers/mtd/nand/raw/cs553x_nand.c
@@ -315,6 +315,7 @@  static void __exit cs553x_cleanup(void)
 		struct mtd_info *mtd = cs553x_mtd[i];
 		struct nand_chip *this;
 		void __iomem *mmio_base;
+		int ret;
 
 		if (!mtd)
 			continue;
@@ -323,8 +324,9 @@  static void __exit cs553x_cleanup(void)
 		mmio_base = this->legacy.IO_ADDR_R;
 
 		/* Release resources, unregister device */
-		nand_release(this);
-		kfree(mtd->name);
+		ret = mtd_device_unregister(mtd);
+		WARN_ON(ret);
+		nand_cleanup(this);
 		cs553x_mtd[i] = NULL;
 
 		/* unmap physical address */