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

Message ID 1614665298-115183-1-git-send-email-jiapeng.chong@linux.alibaba.com
State New
Headers show
Series
  • scsi: ufs: convert sysfs sprintf/snprintf family to sysfs_emit
Related show

Commit Message

Jiapeng Chong March 2, 2021, 6:08 a.m.
Fix the following coccicheck warning:

./drivers/scsi/ufs/ufshcd.c:1538: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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Avri Altman March 2, 2021, 7:04 a.m. | #1
> Fix the following coccicheck warning:

> 

> ./drivers/scsi/ufs/ufshcd.c:1538: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>


> ---

>  drivers/scsi/ufs/ufshcd.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c

> index 7716175..7fb94d7 100644

> --- a/drivers/scsi/ufs/ufshcd.c

> +++ b/drivers/scsi/ufs/ufshcd.c

> @@ -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
Martin K. Petersen March 4, 2021, 4:16 a.m. | #2
On Tue, 2 Mar 2021 14:08:18 +0800, Jiapeng Chong wrote:

> Fix the following coccicheck warning:

> 

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

> sprintf.


Applied to 5.12/scsi-fixes, thanks!

[1/1] scsi: ufs: convert sysfs sprintf/snprintf family to sysfs_emit
      https://git.kernel.org/mkp/scsi/c/7393d296d6f2

-- 
Martin K. Petersen	Oracle Linux Engineering

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 7716175..7fb94d7 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -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,