linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Fang <f.fangjian@huawei.com>
To: <linux@roeck-us.net>, <linux-hwmon@vger.kernel.org>
Cc: <tangzihao1@hisilicon.com>, <huangdaode@huawei.com>
Subject: [PATCH] hwmon: (ina3221) Convert sysfs sprintf/snprintf family to sysfs_emit
Date: Mon, 22 Mar 2021 11:09:37 +0800	[thread overview]
Message-ID: <1616382577-63691-1-git-send-email-f.fangjian@huawei.com> (raw)

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


             reply	other threads:[~2021-03-22  3:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22  3:09 Jay Fang [this message]
2021-03-22  3:31 ` [PATCH] hwmon: (ina3221) Convert sysfs sprintf/snprintf family to sysfs_emit Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1616382577-63691-1-git-send-email-f.fangjian@huawei.com \
    --to=f.fangjian@huawei.com \
    --cc=huangdaode@huawei.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=tangzihao1@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).