ice: devlink: use %*phD to print small buffer
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 7 Oct 2020 17:54:40 +0000 (10:54 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 9 Oct 2020 20:14:19 +0000 (13:14 -0700)
Use %*phD format to print small buffer as hex string.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_devlink.c

index e17b440..29b8864 100644 (file)
@@ -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;
 }