Skip to content

Commit 86da8be

Browse files
andy-shevlag-linaro
authored andcommitted
mfd: intel_soc_pmic_bxtwc: Use sysfs_emit() instead of sprintf()
sysfs_emit() is preferred over sprintf() when formatting the value to be returned to user space in show() functions, because it knows about sysfs buffer specifics and has sanity checks. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f801556 commit 86da8be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/mfd/intel_soc_pmic_bxtwc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static unsigned long bxtwc_reg_addr;
334334
static ssize_t addr_show(struct device *dev,
335335
struct device_attribute *attr, char *buf)
336336
{
337-
return sprintf(buf, "0x%lx\n", bxtwc_reg_addr);
337+
return sysfs_emit(buf, "0x%lx\n", bxtwc_reg_addr);
338338
}
339339

340340
static ssize_t addr_store(struct device *dev,
@@ -362,7 +362,7 @@ static ssize_t val_show(struct device *dev,
362362
return ret;
363363
}
364364

365-
return sprintf(buf, "0x%02x\n", val);
365+
return sysfs_emit(buf, "0x%02x\n", val);
366366
}
367367

368368
static ssize_t val_store(struct device *dev,

0 commit comments

Comments
 (0)