From: Sasha Levin <sashal@kernel•org>
To: linux-kernel@vger•kernel.org, stable@vger•kernel.org
Cc: Yang Guang <yang.guang5@zte•com.cn>,
Zeal Robot <zealci@zte•com.cn>,
David Yang <davidcomponentone@gmail•com>,
Richard Cochran <richardcochran@gmail•com>,
"David S . Miller" <davem@davemloft•net>,
Sasha Levin <sashal@kernel•org>,
netdev@vger•kernel.org
Subject: [PATCH AUTOSEL 4.19 04/29] ptp: replace snprintf with sysfs_emit
Date: Fri, 1 Apr 2022 10:45:47 -0400 [thread overview]
Message-ID: <20220401144612.1955177-4-sashal@kernel.org> (raw)
In-Reply-To: <20220401144612.1955177-1-sashal@kernel.org>
From: Yang Guang <yang.guang5@zte•com.cn>
[ Upstream commit e2cf07654efb0fd7bbcb475c6f74be7b5755a8fd ]
coccinelle report:
./drivers/ptp/ptp_sysfs.c:17:8-16:
WARNING: use scnprintf or sprintf
./drivers/ptp/ptp_sysfs.c:390:8-16:
WARNING: use scnprintf or sprintf
Use sysfs_emit instead of scnprintf or sprintf makes more sense.
Reported-by: Zeal Robot <zealci@zte•com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte•com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail•com>
Acked-by: Richard Cochran <richardcochran@gmail•com>
Signed-off-by: David S. Miller <davem@davemloft•net>
Signed-off-by: Sasha Levin <sashal@kernel•org>
---
drivers/ptp/ptp_sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c
index 48401dfcd999..f97a5eefa2e2 100644
--- a/drivers/ptp/ptp_sysfs.c
+++ b/drivers/ptp/ptp_sysfs.c
@@ -26,7 +26,7 @@ static ssize_t clock_name_show(struct device *dev,
struct device_attribute *attr, char *page)
{
struct ptp_clock *ptp = dev_get_drvdata(dev);
- return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name);
+ return sysfs_emit(page, "%s\n", ptp->info->name);
}
static DEVICE_ATTR_RO(clock_name);
@@ -240,7 +240,7 @@ static ssize_t ptp_pin_show(struct device *dev, struct device_attribute *attr,
mutex_unlock(&ptp->pincfg_mux);
- return snprintf(page, PAGE_SIZE, "%u %u\n", func, chan);
+ return sysfs_emit(page, "%u %u\n", func, chan);
}
static ssize_t ptp_pin_store(struct device *dev, struct device_attribute *attr,
--
2.34.1
next prev parent reply other threads:[~2022-04-01 15:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220401144612.1955177-1-sashal@kernel.org>
2022-04-01 14:45 ` [PATCH AUTOSEL 4.19 02/29] ath5k: fix OOB in ath5k_eeprom_read_pcal_info_5111 Sasha Levin
2022-04-01 14:45 ` Sasha Levin [this message]
2022-04-01 14:45 ` [PATCH AUTOSEL 4.19 14/29] ipv4: Invalidate neighbour for broadcast address upon address addition Sasha Levin
2022-04-01 14:46 ` [PATCH AUTOSEL 4.19 19/29] net/smc: correct settings of RMB window update limit Sasha Levin
2022-04-01 14:46 ` [PATCH AUTOSEL 4.19 20/29] macvtap: advertise link netns via netlink Sasha Levin
2022-04-01 14:46 ` [PATCH AUTOSEL 4.19 21/29] bnxt_en: Eliminate unintended link toggle during FW reset Sasha Levin
2022-04-01 14:46 ` [PATCH AUTOSEL 4.19 27/29] Bluetooth: Fix use after free in hci_send_acl Sasha Levin
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=20220401144612.1955177-4-sashal@kernel.org \
--to=sashal@kernel$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=davidcomponentone@gmail$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=richardcochran@gmail$(echo .)com \
--cc=stable@vger$(echo .)kernel.org \
--cc=yang.guang5@zte$(echo .)com.cn \
--cc=zealci@zte$(echo .)com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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