[PATCH v1 2/2] mtd: spi-nor: hide flash name when the flash name does not exist

Jaime Liao jaimeliao.tw at gmail.com
Mon Nov 27 02:07:54 PST 2023


From: JaimeLiao <jaimeliao at mxic.com.tw>

(null) will print when flash ID founded in ID table but
the flash name didn't include in it.

Make info->name optional in the print for showing flash name
and flash size.

Signed-off-by: JaimeLiao <jaimeliao at mxic.com.tw>
---
 drivers/mtd/spi-nor/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 1c443fe568cf..73405bed2a5a 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3518,7 +3518,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
 	/* No mtd_info fields should be used up to this point. */
 	spi_nor_set_mtd_info(nor);
 
-	dev_info(dev, "%s (%lld Kbytes)\n", info->name,
+	dev_info(dev, "%s (%lld Kbytes)\n", info->name ?: "",
 			(long long)mtd->size >> 10);
 
 	dev_dbg(dev,
-- 
2.25.1




More information about the linux-mtd mailing list