summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-09-11 22:46:27 +0300
committerGuenter Roeck <linux@roeck-us.net>2024-09-12 14:17:29 -0700
commit38f9fa39afe119f6b2771c9065e638414226c86d (patch)
treef043bc954628cd5a709bd1ee80fb01ff6c886909 /drivers/hwmon
parentd22bd451d5606411895ef55cb105277e4f4f6e54 (diff)
downloadlinux-38f9fa39afe119f6b2771c9065e638414226c86d.tar.gz
linux-38f9fa39afe119f6b2771c9065e638414226c86d.tar.bz2
linux-38f9fa39afe119f6b2771c9065e638414226c86d.zip
hwmon: (sht21) Use %*ph to print small buffer
Use %*ph format to print small buffer as hex string. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Message-ID: <20240911194627.2885506-1-andriy.shevchenko@linux.intel.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/sht21.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/hwmon/sht21.c b/drivers/hwmon/sht21.c
index ad1b827ea782..97327313529b 100644
--- a/drivers/hwmon/sht21.c
+++ b/drivers/hwmon/sht21.c
@@ -199,10 +199,7 @@ static ssize_t eic_read(struct sht21 *sht21)
eic[6] = rx[0];
eic[7] = rx[1];
- ret = snprintf(sht21->eic, sizeof(sht21->eic),
- "%02x%02x%02x%02x%02x%02x%02x%02x\n",
- eic[0], eic[1], eic[2], eic[3],
- eic[4], eic[5], eic[6], eic[7]);
+ ret = snprintf(sht21->eic, sizeof(sht21->eic), "%8phN\n", eic);
out:
if (ret < 0)
sht21->eic[0] = 0;