diff mbox series

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

Message ID 1612337990-88873-1-git-send-email-jiapeng.chong@linux.alibaba.com
State New
Headers show
Series scsi: ufs: convert sysfs sprintf/snprintf family to sysfs_emit | expand

Commit Message

Jiapeng Chong Feb. 3, 2021, 7:39 a.m. UTC
Fix the following coccicheck warning:

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

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

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

Reported-by: Abaci Robot<abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/scsi/ufs/ufshcd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Avri Altman Feb. 3, 2021, 7:49 a.m. UTC | #1
> 
> Fix the following coccicheck warning:
> 
> ./drivers/scsi/ufs/ufshcd.c:1838:8-16: WARNING: use scnprintf or
> sprintf.
> 
> ./drivers/scsi/ufs/ufshcd.c:1815:8-16: WARNING: use scnprintf or
> sprintf.
> 
> ./drivers/scsi/ufs/ufshcd.c:1525:8-16: WARNING: use scnprintf or
> sprintf.
> 
> Reported-by: Abaci Robot<abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Martin K. Petersen Feb. 9, 2021, 3:12 a.m. UTC | #2
Jiapeng,

> Fix the following coccicheck warning:

>

> ./drivers/scsi/ufs/ufshcd.c:1838:8-16: WARNING: use scnprintf or

> sprintf.

>

> ./drivers/scsi/ufs/ufshcd.c:1815:8-16: WARNING: use scnprintf or

> sprintf.

>

> ./drivers/scsi/ufs/ufshcd.c:1525:8-16: WARNING: use scnprintf or

> sprintf.


Does not apply to 5.12/scsi-staging. Please rebase.

-- 
Martin K. Petersen	Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index fb32d12..292cb63 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1522,7 +1522,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_allowed);
+	return sysfs_emit(buf, "%d\n", hba->clk_scaling.is_allowed);
 }
 
 static ssize_t ufshcd_clkscale_enable_store(struct device *dev,
@@ -1812,7 +1812,7 @@  static ssize_t ufshcd_clkgate_delay_show(struct device *dev,
 {
 	struct ufs_hba *hba = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%lu\n", hba->clk_gating.delay_ms);
+	return sysfs_emit(buf, "%lu\n", hba->clk_gating.delay_ms);
 }
 
 static ssize_t ufshcd_clkgate_delay_store(struct device *dev,
@@ -1835,7 +1835,7 @@  static ssize_t ufshcd_clkgate_enable_show(struct device *dev,
 {
 	struct ufs_hba *hba = dev_get_drvdata(dev);
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", hba->clk_gating.is_enabled);
+	return sysfs_emit(buf, "%d\n", hba->clk_gating.is_enabled);
 }
 
 static ssize_t ufshcd_clkgate_enable_store(struct device *dev,