Skip to contentSkip to conversation

mtd: nftl: use %*ph to print small buffer

PATCH Applied Antonio Cardace 3 participants 3 messages Feb 13, 2018 – Mar 18, 2018 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: nftl: use %*ph to print small buffer

Use %*ph format to print small buffer as hex string.

---
What about this one?

 drivers/mtd/nftlmount.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nftlmount.c +1 -2
index 184c8fbfe465..a8bdc1455b50 100644
@@ -122,8 +122,7 @@ static int find_boot_record(struct NFTLrecord *nftl)
 		if (memcmp(buf, "ANAND", 6)) {
 			printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but went away on reread!\n",
 			       block * nftl->EraseSize, nftl->mbd.mtd->index);
-			printk(KERN_NOTICE "New data are: %02x %02x %02x %02x %02x %02x\n",
-			       buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
+			printk(KERN_NOTICE "New data are: %6ph\n", buf);
 			continue;
 		}
 #endif
Signature · 1 line
2.15.1.354.g95ec6b1b3
#1 lore raw
Quoted 2 lines · Antonio Cardace

Use %*ph format to print small buffer as hex string.

Any comments so far?

Quoted 27 lines

---

 drivers/mtd/nftlmount.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nftlmount.c +0 -2
index 184c8fbfe465..a8bdc1455b50 100644
@@ -122,8 +122,7 @@ static int find_boot_record(struct NFTLrecord
 *nftl)
 		if (memcmp(buf, "ANAND", 6)) {
 			printk(KERN_NOTICE "ANAND header found at
 0x%x in mtd%d, but went away on reread!\n",
 			       block * nftl->EraseSize, nftl-
 >mbd.mtd->index);
-			printk(KERN_NOTICE "New data are: %02x %02x
 %02x %02x %02x %02x\n",
-			       buf[0], buf[1], buf[2], buf[3],

buf[4], buf[5]);

drivers/mtd/nftlmount.c +1 -0
+			printk(KERN_NOTICE "New data are: %6ph\n",

buf);

drivers/mtd/nftlmount.c +0 -0
 			continue;
 		}
 #endif
Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#2 lore raw
In reply to Antonio Cardace
Quoted 1 line · On Tue, 13 Feb 2018 17:52:45 +0000 Antonio Cardace <[email protected]>…

Use %*ph format to print small buffer as hex string.

Applied.

Thanks,

Boris

Quoted 23 lines

---
What about this one?

 drivers/mtd/nftlmount.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nftlmount.c +1 -2
index 184c8fbfe465..a8bdc1455b50 100644
@@ -122,8 +122,7 @@ static int find_boot_record(struct NFTLrecord *nftl)
 		if (memcmp(buf, "ANAND", 6)) {
 			printk(KERN_NOTICE "ANAND header found at 0x%x in mtd%d, but went away on reread!\n",
 			       block * nftl->EraseSize, nftl->mbd.mtd->index);
-			printk(KERN_NOTICE "New data are: %02x %02x %02x %02x %02x %02x\n",
-			       buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
+			printk(KERN_NOTICE "New data are: %6ph\n", buf);
 			continue;
 		}
 #endif
Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com