diff mbox series

mtd: spinand: Fix display of unknown raw ID

Message ID 20230213173005.913823-1-patrice.chotard@foss.st.com
State Accepted, archived
Commit 4f64a310fc1610dec167be0a999ec3849f9e0e3c
Delegated to: Dario Binacchi
Headers show
Series mtd: spinand: Fix display of unknown raw ID | expand

Commit Message

Patrice CHOTARD Feb. 13, 2023, 5:30 p.m. UTC
In case ID is not found in manufacturer table, the raw ID is
printed using %*phN format which is not supported by lib/vsprintf.c.
The information displayed doesn't reflect the raw ID return by the
unknown spi-nand.

Use %02x format instead, as done in spi-nor-core.c.

For example, before this patch:
  ERROR: spi-nand: spi_nand flash@0: unknown raw ID f74ec040
after
  ERROR: spi-nand: spi_nand flash@0: unknown raw ID 00 c2 26 03

Fixes: 0a6d6bae0386 ("mtd: nand: Add core infrastructure to support SPI NANDs")

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
---

 drivers/mtd/nand/spi/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Frieder Schrempf Feb. 14, 2023, 8:14 a.m. UTC | #1
On 13.02.23 18:30, Patrice Chotard wrote:
> In case ID is not found in manufacturer table, the raw ID is
> printed using %*phN format which is not supported by lib/vsprintf.c.
> The information displayed doesn't reflect the raw ID return by the
> unknown spi-nand.
> 
> Use %02x format instead, as done in spi-nor-core.c.
> 
> For example, before this patch:
>   ERROR: spi-nand: spi_nand flash@0: unknown raw ID f74ec040
> after
>   ERROR: spi-nand: spi_nand flash@0: unknown raw ID 00 c2 26 03
> 
> Fixes: 0a6d6bae0386 ("mtd: nand: Add core infrastructure to support SPI NANDs")
> 
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Michael Nazzareno Trimarchi Feb. 14, 2023, 10:52 a.m. UTC | #2
Hi

On Tue, Feb 14, 2023 at 9:14 AM Frieder Schrempf
<frieder.schrempf@kontron.de> wrote:
>
> On 13.02.23 18:30, Patrice Chotard wrote:
> > In case ID is not found in manufacturer table, the raw ID is
> > printed using %*phN format which is not supported by lib/vsprintf.c.
> > The information displayed doesn't reflect the raw ID return by the
> > unknown spi-nand.
> >
> > Use %02x format instead, as done in spi-nor-core.c.
> >
> > For example, before this patch:
> >   ERROR: spi-nand: spi_nand flash@0: unknown raw ID f74ec040
> > after
> >   ERROR: spi-nand: spi_nand flash@0: unknown raw ID 00 c2 26 03
> >
> > Fixes: 0a6d6bae0386 ("mtd: nand: Add core infrastructure to support SPI NANDs")
> >
> > Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>
> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

Acked-by: Michael Trimarchi <michael@amarulasolutions.com>
Michael Nazzareno Trimarchi Feb. 27, 2023, 6:07 p.m. UTC | #3
Hi

On Tue, Feb 14, 2023 at 11:52 AM Michael Nazzareno Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Hi
>
> On Tue, Feb 14, 2023 at 9:14 AM Frieder Schrempf
> <frieder.schrempf@kontron.de> wrote:
> >
> > On 13.02.23 18:30, Patrice Chotard wrote:
> > > In case ID is not found in manufacturer table, the raw ID is
> > > printed using %*phN format which is not supported by lib/vsprintf.c.
> > > The information displayed doesn't reflect the raw ID return by the
> > > unknown spi-nand.
> > >
> > > Use %02x format instead, as done in spi-nor-core.c.
> > >
> > > For example, before this patch:
> > >   ERROR: spi-nand: spi_nand flash@0: unknown raw ID f74ec040
> > > after
> > >   ERROR: spi-nand: spi_nand flash@0: unknown raw ID 00 c2 26 03
> > >
> > > Fixes: 0a6d6bae0386 ("mtd: nand: Add core infrastructure to support SPI NANDs")
> > >
> > > Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> >
> > Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>
> Acked-by: Michael Trimarchi <michael@amarulasolutions.com>
>

Applied thanks

Michael
diff mbox series

Patch

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 134bf22c805..70d8ae531ee 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -979,8 +979,9 @@  static int spinand_detect(struct spinand_device *spinand)
 
 	ret = spinand_manufacturer_detect(spinand);
 	if (ret) {
-		dev_err(spinand->slave->dev, "unknown raw ID %*phN\n",
-			SPINAND_MAX_ID_LEN, spinand->id.data);
+		dev_err(spinand->slave->dev, "unknown raw ID %02x %02x %02x %02x\n",
+			spinand->id.data[0], spinand->id.data[1],
+			spinand->id.data[2], spinand->id.data[3]);
 		return ret;
 	}