[PATCH] mtd: mtdpart: Convert sysfs sprintf/snprintf family to sysfs_emit

Tian Tao tiantao6 at hisilicon.com
Mon Apr 12 07:50:07 BST 2021


Fix the following coccicheck warning:
drivers/mtd/mtdpart.c:220:8-16: WARNING: use scnprintf or sprintf

Signed-off-by: Tian Tao <tiantao6 at hisilicon.com>
---
 drivers/mtd/mtdpart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 665fd90..66a67c6 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -217,7 +217,7 @@ static ssize_t mtd_partition_offset_show(struct device *dev,
 {
 	struct mtd_info *mtd = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%lld\n", mtd->part.offset);
+	return sysfs_emit(buf, "%lld\n", mtd->part.offset);
 }
 
 static DEVICE_ATTR(offset, S_IRUGO, mtd_partition_offset_show, NULL);
-- 
2.7.4




More information about the linux-mtd mailing list