Skip to contentSkip to conversation

mtd: uboot: Fix hanging during mtd list command

PATCH Superseded Adam Ford 2 participants 2 messages Oct 8, 2018 Memory technology devices (MTD)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH v2 1/1 mtd: uboot: Fix hanging during mtd list command

Some boards using simple NAND drivers (like omap3_logic) hang when executing the new 'mtd list' command. This patch enhances the checks for conditions that would preclude mtd_probe_devices() from operating.

Fixes 5db66b3aee6f ("cmd: mtd: add 'mtd' command")

---
V2: Move the check for NULL mtdparts or mtdids until after the
partitions have been removed.

drivers/mtd/mtd_uboot.c +8 -1
index 6a211d52ff..7d7a11c990 100644
@@ -104,7 +104,10 @@ int mtd_probe_devices(void)
 	mtd_probe_uclass_mtd_devs();
 
 	/* Check if mtdparts/mtdids changed since last call, otherwise: exit */
-	if (!strcmp(mtdparts, old_mtdparts) && !strcmp(mtdids, old_mtdids))
+	if ((!mtdparts && !old_mtdparts && !mtdids && !old_mtdids) ||
+	    (mtdparts && old_mtdparts && mtdids && old_mtdids &&
+	     !strcmp(mtdparts, old_mtdparts) &&
+	     !strcmp(mtdids, old_mtdids)))
 		return 0;
 
 	/* Update the local copy of mtdparts */
@@ -140,6 +143,10 @@ int mtd_probe_devices(void)
 		}
 	}
 
+	/* If either mtdparts or mtdids is empty, then exit */
+	if (!mtdparts || !mtdids)
+		return 0;
+
 	/* Start the parsing by ignoring the extra 'mtdparts=' prefix, if any */
 	if (strstr(mtdparts, "mtdparts="))
 		mtdparts += 9;
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 mtd: uboot: Fix hanging during mtd list command

Quoted 2 lines · On Mon, 8 Oct 2018 13:39:31 -0500 Adam Ford <[email protected]> wrote:

Some boards using simple NAND drivers (like omap3_logic) hang when executing the new 'mtd list' command. This patch enhances

^One too many spaces here.

Also, i don't think it has to do with simple/old NAND drivers vs new ones, it's more related to how the platform behaves when you access address 0 (NULL). I guess on Miquel's CPU address 0 is accessible, on yours it's not.

Quoted 5 lines

the checks for conditions that would preclude mtd_probe_devices() from operating.

Fixes 5db66b3aee6f ("cmd: mtd: add 'mtd' command")

You can drop the blank line here.

Quoted 2 lines

Once my comments on the commit message are addressed, you can add

Quoted 31 lines

---
V2: Move the check for NULL mtdparts or mtdids until after the
partitions have been removed.

drivers/mtd/mtd_uboot.c +8 -1
index 6a211d52ff..7d7a11c990 100644
@@ -104,7 +104,10 @@ int mtd_probe_devices(void)
 	mtd_probe_uclass_mtd_devs();
 
 	/* Check if mtdparts/mtdids changed since last call, otherwise: exit */
-	if (!strcmp(mtdparts, old_mtdparts) && !strcmp(mtdids, old_mtdids))
+	if ((!mtdparts && !old_mtdparts && !mtdids && !old_mtdids) ||
+	    (mtdparts && old_mtdparts && mtdids && old_mtdids &&
+	     !strcmp(mtdparts, old_mtdparts) &&
+	     !strcmp(mtdids, old_mtdids)))
 		return 0;
 
 	/* Update the local copy of mtdparts */
@@ -140,6 +143,10 @@ int mtd_probe_devices(void)
 		}
 	}
 
+	/* If either mtdparts or mtdids is empty, then exit */
+	if (!mtdparts || !mtdids)
+		return 0;
+
 	/* Start the parsing by ignoring the extra 'mtdparts=' prefix, if any */
 	if (strstr(mtdparts, "mtdparts="))
 		mtdparts += 9;