* [U-Boot] [PATCH] mtd: uboot: Fix hanging during mtd list command
@ 2018-10-08 18:23 Adam Ford
2018-10-08 18:28 ` Boris Brezillon
0 siblings, 1 reply; 3+ messages in thread
From: Adam Ford @ 2018-10-08 18:23 UTC (permalink / raw)
To: u-boot
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 <aford173@gmail.com>
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot] [PATCH] mtd: uboot: Fix hanging during mtd list command
2018-10-08 18:23 [U-Boot] [PATCH] mtd: uboot: Fix hanging during mtd list command Adam Ford
@ 2018-10-08 18:28 ` Boris Brezillon
2018-10-08 18:32 ` Adam Ford
0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2018-10-08 18:28 UTC (permalink / raw)
To: u-boot
On Mon, 8 Oct 2018 13:23:06 -0500
Adam Ford <aford173@gmail.com> 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 preclude mtd_probe_devices()
> from operating.
>
> Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command")
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> 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;
We should first remove all partitions before bailing out, hence my
proposal to place this check after the 'while (remaining_partitions)'
loop.
>
> /* Update the local copy of mtdparts */
^ permalink raw reply [flat|nested] 3+ messages in thread* [U-Boot] [PATCH] mtd: uboot: Fix hanging during mtd list command
2018-10-08 18:28 ` Boris Brezillon
@ 2018-10-08 18:32 ` Adam Ford
0 siblings, 0 replies; 3+ messages in thread
From: Adam Ford @ 2018-10-08 18:32 UTC (permalink / raw)
To: u-boot
On Mon, Oct 8, 2018 at 1:28 PM Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
>
> On Mon, 8 Oct 2018 13:23:06 -0500
> Adam Ford <aford173@gmail.com> 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 preclude mtd_probe_devices()
> > from operating.
> >
> > Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command")
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> >
> > 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;
>
> 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
>
> >
> > /* Update the local copy of mtdparts */
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-08 18:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-08 18:23 [U-Boot] [PATCH] mtd: uboot: Fix hanging during mtd list command Adam Ford
2018-10-08 18:28 ` Boris Brezillon
2018-10-08 18:32 ` Adam Ford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox