From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Ford Date: Mon, 8 Oct 2018 13:23:06 -0500 Subject: [U-Boot] [PATCH] mtd: uboot: Fix hanging during mtd list command Message-ID: <20181008182307.19122-1-aford173@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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") Signed-off-by: Adam Ford diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c index 6a211d52ff..91a4a8a9c0 100644 --- a/drivers/mtd/mtd_uboot.c +++ b/drivers/mtd/mtd_uboot.c @@ -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 */ -- 2.17.1