diff mbox series

hwmon: (ina3221) Convert sysfs sprintf/snprintf family to sysfs_emit

Message ID 1616382577-63691-1-git-send-email-f.fangjian@huawei.com (mailing list archive)
State Accepted
Headers show
Series hwmon: (ina3221) Convert sysfs sprintf/snprintf family to sysfs_emit | expand

Commit Message

Jay Fang March 22, 2021, 3:09 a.m. UTC
From: Zihao Tang <tangzihao1@hisilicon.com>

Fix the following coccicheck warning:

drivers/hwmon/ina3221.c:701:8-16: WARNING: use scnprintf or sprintf

Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com>
Signed-off-by: Jay Fang <f.fangjian@huawei.com>
---
 drivers/hwmon/ina3221.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck March 22, 2021, 3:31 a.m. UTC | #1
On 3/21/21 8:09 PM, Jay Fang wrote:
> From: Zihao Tang <tangzihao1@hisilicon.com>
> 
> Fix the following coccicheck warning:
> 
> drivers/hwmon/ina3221.c:701:8-16: WARNING: use scnprintf or sprintf
> 
> Signed-off-by: Zihao Tang <tangzihao1@hisilicon.com>
> Signed-off-by: Jay Fang <f.fangjian@huawei.com>
> ---
>  drivers/hwmon/ina3221.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
> index d80bd3e..c602583 100644
> --- a/drivers/hwmon/ina3221.c
> +++ b/drivers/hwmon/ina3221.c
> @@ -698,7 +698,7 @@ static ssize_t ina3221_shunt_show(struct device *dev,
>  	unsigned int channel = sd_attr->index;
>  	struct ina3221_input *input = &ina->inputs[channel];
>  
> -	return snprintf(buf, PAGE_SIZE, "%d\n", input->shunt_resistor);
> +	return sysfs_emit(buf, "%d\n", input->shunt_resistor);
>  }
>  
>  static ssize_t ina3221_shunt_store(struct device *dev,
> 
Please stop with those patches. They have zero real value, and just take
time to review and apply. When I have time, I'll create a coccinelle script
to convert them all in one go.

Thanks,
Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
index d80bd3e..c602583 100644
--- a/drivers/hwmon/ina3221.c
+++ b/drivers/hwmon/ina3221.c
@@ -698,7 +698,7 @@  static ssize_t ina3221_shunt_show(struct device *dev,
 	unsigned int channel = sd_attr->index;
 	struct ina3221_input *input = &ina->inputs[channel];
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", input->shunt_resistor);
+	return sysfs_emit(buf, "%d\n", input->shunt_resistor);
 }
 
 static ssize_t ina3221_shunt_store(struct device *dev,