Skip to contentSkip to conversation

scsi: ufs: convert sysfs sprintf/snprintf family to sysfs_emit

PATCH Applied Jiapeng Chong 3 participants 3 messages Mar 2, 2021 – Mar 4, 2021 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs: convert sysfs sprintf/snprintf family to sysfs_emit

Fix the following coccicheck warning:

./drivers/scsi/ufs/ufshcd.c:1538:8-16: WARNING: use scnprintf or sprintf.

---
 drivers/scsi/ufs/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +1 -1
index 7716175..7fb94d7 100644
@@ -1535,7 +1535,7 @@ static ssize_t ufshcd_clkscale_enable_show(struct device *dev,
 {
 	struct ufs_hba *hba = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", hba->clk_scaling.is_enabled);
+	return sysfs_emit(buf, "%d\n", hba->clk_scaling.is_enabled);
 }
 
 static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines

Fix the following coccicheck warning:

./drivers/scsi/ufs/ufshcd.c:1538:8-16: WARNING: use scnprintf or sprintf.

Quoted 20 lines
---
 drivers/scsi/ufs/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ufs/ufshcd.c +1 -1
index 7716175..7fb94d7 100644
@@ -1535,7 +1535,7 @@ static ssize_t ufshcd_clkscale_enable_show(struct
 device *dev,
 {
        struct ufs_hba *hba = dev_get_drvdata(dev);
 
-       return snprintf(buf, PAGE_SIZE, "%d\n", hba->clk_scaling.is_enabled);
+       return sysfs_emit(buf, "%d\n", hba->clk_scaling.is_enabled);
 }
 

static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
--
1.8.3.1