linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (ina3221) Convert sysfs sprintf/snprintf family to sysfs_emit
@ 2021-03-22  3:09 Jay Fang
  2021-03-22  3:31 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Jay Fang @ 2021-03-22  3:09 UTC (permalink / raw)
  To: linux, linux-hwmon; +Cc: tangzihao1, huangdaode

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,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwmon: (ina3221) Convert sysfs sprintf/snprintf family to sysfs_emit
  2021-03-22  3:09 [PATCH] hwmon: (ina3221) Convert sysfs sprintf/snprintf family to sysfs_emit Jay Fang
@ 2021-03-22  3:31 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2021-03-22  3:31 UTC (permalink / raw)
  To: Jay Fang, linux-hwmon; +Cc: tangzihao1, huangdaode

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-22  3:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22  3:09 [PATCH] hwmon: (ina3221) Convert sysfs sprintf/snprintf family to sysfs_emit Jay Fang
2021-03-22  3:31 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).