mtd: uboot: Fix hanging during mtd list command
PATCH 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.
drivers/mtd/mtd_uboot.c +8 -1
@@ -104,7 +104,14 @@ 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 ; + +/* If either mtdparts or mtdids is empty, then exit */ +if (!mtdparts || !mtdids)return 0 ;/* Update the local copy of mtdparts */
Signature · 1 line
2.17.1
PATCH 1/1 mtd: uboot: Fix hanging during mtd list command
Quoted 17 lines · On Mon, 8 Oct 2018 13:23:06 -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 the checks for conditions that would precludemtd_probe_devices()from operating.Fixes 5db66b3aee6f ("cmd: mtd: add 'mtd' command")Signed-off-by Adam Ford <[email protected]>drivers/mtd/mtd_uboot.c +0
-0@@ -104,7 +104,14 @@ int mtd_probe_devices(void)mtd_probe_uclass_mtd_devs ();/* Check if mtdparts/mtdids changed since last call, otherwise: exit */
drivers/mtd/mtd_uboot.c int mtd_probe_devices(void) · line 115
Quoted 10 lines
drivers/mtd/mtd_uboot.c +8
-1-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 ; + +/* If either mtdparts or mtdids is empty, then exit */ +if (!mtdparts || !mtdids)return 0 ;
We should first remove all partitions before bailing out, hence my proposal to place this check after the 'while (remaining_partitions)' loop.
Quoted 2 lines
drivers/mtd/mtd_uboot.c +0
-0/* Update the local copy of mtdparts */
PATCH 1/1 mtd: uboot: Fix hanging during mtd list command
Quoted 20 lines · Boris Brezillon
Quoted 16 lines · On Mon, 8 Oct 2018 13:23:06 -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 the checks for conditions that would precludemtd_probe_devices()from operating.Fixes 5db66b3aee6f ("cmd: mtd: add 'mtd' command")Signed-off-by Adam Ford <[email protected]>drivers/mtd/mtd_uboot.c +0
-0@@ -104,7 +104,14 @@ int mtd_probe_devices(void)mtd_probe_uclass_mtd_devs ();
Quoted 15 lines
drivers/mtd/mtd_uboot.c int mtd_probe_devices(void) · line 115
Quoted 11 lines
drivers/mtd/mtd_uboot.c +8
-1/* 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 ; + +/* If either mtdparts or mtdids is empty, then exit */ +if (!mtdparts || !mtdids)return 0 ;We should first remove all partitions before bailing out, hence my proposal to place this check after the 'while (
remaining_partitions)' loop.
Sorry. Gmail filtered it in a way that it was hard to tell where it went. I'll submit a V2 fix in just a moment.
adam
Quoted 4 lines
Quoted 3 lines
drivers/mtd/mtd_uboot.c +0
-0/* Update the local copy of mtdparts */