netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] ice: devlink: use %*phD to print small buffer
@ 2020-07-30 16:04 Andy Shevchenko
  2020-07-30 21:20 ` Jacob Keller
  2020-07-31 23:49 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-07-30 16:04 UTC (permalink / raw)
  To: Jeff Kirsher, intel-wired-lan, David S. Miller, Jakub Kicinski,
	netdev, Jacob Keller
  Cc: Andy Shevchenko

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

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/net/ethernet/intel/ice/ice_devlink.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
index dbbd8b6f9d1a..a9105ad5b983 100644
--- a/drivers/net/ethernet/intel/ice/ice_devlink.c
+++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
@@ -13,9 +13,7 @@ static int ice_info_get_dsn(struct ice_pf *pf, char *buf, size_t len)
 	/* Copy the DSN into an array in Big Endian format */
 	put_unaligned_be64(pci_get_dsn(pf->pdev), dsn);
 
-	snprintf(buf, len, "%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x",
-		 dsn[0], dsn[1], dsn[2], dsn[3],
-		 dsn[4], dsn[5], dsn[6], dsn[7]);
+	snprintf(buf, len, "%8phD", dsn);
 
 	return 0;
 }
-- 
2.27.0


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

end of thread, other threads:[~2020-08-01  0:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 16:04 [PATCH v1] ice: devlink: use %*phD to print small buffer Andy Shevchenko
2020-07-30 21:20 ` Jacob Keller
2020-07-31  7:49   ` Andy Shevchenko
2020-07-31 23:49 ` David Miller
2020-08-01  0:07   ` [Intel-wired-lan] " Nguyen, Anthony L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).