Skip to contentSkip to conversation

mtd: uboot: Fix hanging during mtd list command

PATCH New Adam Ford 3 participants 6 messages Oct 8, 2018 – Oct 10, 2018 Memory technology devices (MTD)

lore
Share & tools
lore

Adam Ford

author
#0 lore raw

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

Some boards (like omap3_logic) hang when trying to access address 0. This happens 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")

---

V3:  No code change.  Just fix commit comment and typos.
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
maintainer
#1 lore raw

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

Hi Adam,

+Tom

Adam Ford <[email protected]> wrote on Mon, 8 Oct 2018 14:13:03 -0500:

Quoted 10 lines

Some boards (like omap3_logic) hang when trying to access address 0. This happens 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")

---

I planned to create a setup this week with a raw NAND device but it's fine then if it was not related to the device type.

Thank you both for the patch.

Tom, as MTD is orphaned now, you may want to take this patch in the next -rc.

Thanks,
Miquèl

#2 lore raw

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

In reply to Adam Ford
Quoted 11 lines · Adam Ford

Some boards (like omap3_logic) hang when trying to access address 0. This happens 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")

---

Applied to u-boot-spi/master

maintainer
#3 lore raw

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

Hi Jagan,

Jagan Teki <[email protected]> wrote on Wed, 10 Oct 2018 11:32:02 +0530:

Quoted 7 lines · Adam Ford
Quoted 6 lines

Some boards (like omap3_logic) hang when trying to access address 0. This happens when executing the new 'mtd list' command. This patch enhances the checks for conditions that would preclude mtd_probe_devices() from operating.

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

---

Applied to u-boot-spi/master

Thanks for taking the patch but I wonder: shouldn't we apply this patch sooner, ie. in the next -rc? Actually, it has barely nothing to do with the SPI subsystem anyway.

Thanks,
Miquèl

#4 lore raw

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

Quoted 19 lines · Miquel Raynal

Hi Jagan,

Jagan Teki <[email protected]> wrote on Wed, 10 Oct 2018 11:32:02 +0530:

Quoted 13 lines · Adam Ford
Quoted 11 lines

Some boards (like omap3_logic) hang when trying to access address 0. This happens 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")

---

Quoted 5 lines
Quoted 1 line

Applied to u-boot-spi/master

Thanks for taking the patch but I wonder: shouldn't we apply this patch sooner, ie. in the next -rc? Actually, it has barely nothing to do with the SPI subsystem anyway.

Yes, will send the PR soon.

maintainer
#5 lore raw

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

Hi Jagan,

Jagan Teki <[email protected]> wrote on Wed, 10 Oct 2018 18:41:39 +0530:

Quoted 20 lines · Miquel Raynal
Quoted 19 lines

Hi Jagan,

Jagan Teki <[email protected]> wrote on Wed, 10 Oct 2018 11:32:02 +0530:

Quoted 13 lines · Adam Ford
Quoted 11 lines

Some boards (like omap3_logic) hang when trying to access address 0. This happens 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")

---

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Applied to u-boot-spi/master

Thanks for taking the patch but I wonder: shouldn't we apply this patch sooner, ie. in the next -rc? Actually, it has barely nothing to do with the SPI subsystem anyway.

Yes, will send the PR soon.

Ok, no problem then. Thanks for carrying it.

Thanks,
Miquèl