public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V3] mtd: uboot: Fix hanging during mtd list command
@ 2018-10-08 19:13 Adam Ford
  2018-10-08 20:02 ` Miquel Raynal
  2018-10-10  6:02 ` Jagan Teki
  0 siblings, 2 replies; 6+ messages in thread
From: Adam Ford @ 2018-10-08 19:13 UTC (permalink / raw)
  To: u-boot

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")
Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
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.

diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index 6a211d52ff..7d7a11c990 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -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;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V3] mtd: uboot: Fix hanging during mtd list command
  2018-10-08 19:13 [U-Boot] [PATCH V3] mtd: uboot: Fix hanging during mtd list command Adam Ford
@ 2018-10-08 20:02 ` Miquel Raynal
  2018-10-10  6:02 ` Jagan Teki
  1 sibling, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2018-10-08 20:02 UTC (permalink / raw)
  To: u-boot

Hi Adam,

+Tom

Adam Ford <aford173@gmail.com> wrote on Mon,  8 Oct 2018 14:13:03 -0500:

> 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")
> Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com>
> Signed-off-by: Adam Ford <aford173@gmail.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---

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.

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

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

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V3] mtd: uboot: Fix hanging during mtd list command
  2018-10-08 19:13 [U-Boot] [PATCH V3] mtd: uboot: Fix hanging during mtd list command Adam Ford
  2018-10-08 20:02 ` Miquel Raynal
@ 2018-10-10  6:02 ` Jagan Teki
  2018-10-10 13:09   ` Miquel Raynal
  1 sibling, 1 reply; 6+ messages in thread
From: Jagan Teki @ 2018-10-10  6:02 UTC (permalink / raw)
  To: u-boot

On Tue, Oct 9, 2018 at 12:43 AM Adam Ford <aford173@gmail.com> wrote:
>
> 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")
> Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com>
> Signed-off-by: Adam Ford <aford173@gmail.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---

Applied to u-boot-spi/master

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V3] mtd: uboot: Fix hanging during mtd list command
  2018-10-10  6:02 ` Jagan Teki
@ 2018-10-10 13:09   ` Miquel Raynal
  2018-10-10 13:11     ` Jagan Teki
  0 siblings, 1 reply; 6+ messages in thread
From: Miquel Raynal @ 2018-10-10 13:09 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

Jagan Teki <jagan@amarulasolutions.com> wrote on Wed, 10 Oct 2018
11:32:02 +0530:

> On Tue, Oct 9, 2018 at 12:43 AM Adam Ford <aford173@gmail.com> wrote:
> >
> > 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")
> > Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> > Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > ---  
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V3] mtd: uboot: Fix hanging during mtd list command
  2018-10-10 13:09   ` Miquel Raynal
@ 2018-10-10 13:11     ` Jagan Teki
  2018-10-10 13:14       ` Miquel Raynal
  0 siblings, 1 reply; 6+ messages in thread
From: Jagan Teki @ 2018-10-10 13:11 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 10, 2018 at 6:39 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hi Jagan,
>
> Jagan Teki <jagan@amarulasolutions.com> wrote on Wed, 10 Oct 2018
> 11:32:02 +0530:
>
> > On Tue, Oct 9, 2018 at 12:43 AM Adam Ford <aford173@gmail.com> wrote:
> > >
> > > 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")
> > > Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > ---
> >
> > 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V3] mtd: uboot: Fix hanging during mtd list command
  2018-10-10 13:11     ` Jagan Teki
@ 2018-10-10 13:14       ` Miquel Raynal
  0 siblings, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2018-10-10 13:14 UTC (permalink / raw)
  To: u-boot

Hi Jagan,

Jagan Teki <jagan@amarulasolutions.com> wrote on Wed, 10 Oct 2018
18:41:39 +0530:

> On Wed, Oct 10, 2018 at 6:39 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > Hi Jagan,
> >
> > Jagan Teki <jagan@amarulasolutions.com> wrote on Wed, 10 Oct 2018
> > 11:32:02 +0530:
> >  
> > > On Tue, Oct 9, 2018 at 12:43 AM Adam Ford <aford173@gmail.com> wrote:  
> > > >
> > > > 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")
> > > > Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > > Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
> > > > ---  
> > >
> > > 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-10 13:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-08 19:13 [U-Boot] [PATCH V3] mtd: uboot: Fix hanging during mtd list command Adam Ford
2018-10-08 20:02 ` Miquel Raynal
2018-10-10  6:02 ` Jagan Teki
2018-10-10 13:09   ` Miquel Raynal
2018-10-10 13:11     ` Jagan Teki
2018-10-10 13:14       ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox