[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YWfQb6O+HYGZf4iE@shinobu>
Date: Thu, 14 Oct 2021 15:38:39 +0900
From: William Breathitt Gray <vilhelm.gray@...il.com>
To: Qing Wang <wangqing@...o.com>
Cc: Fabrice Gasnier <fabrice.gasnier@...s.st.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
linux-iio@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] counter: replace snprintf in show functions with
sysfs_emit
On Tue, Oct 12, 2021 at 08:26:59PM -0700, Qing Wang wrote:
> coccicheck complains about the use of snprintf() in sysfs show functions.
>
> Fix the following coccicheck warning:
> drivers/counter/stm32-lptimer-cnt.c:265:8-16: WARNING: use scnprintf or sprintf.
> drivers/counter/stm32-lptimer-cnt.c:176:8-16: WARNING: use scnprintf or sprintf.
>
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
>
> Signed-off-by: Qing Wang <wangqing@...o.com>
Hello Qing Wang,
Thank you for your submission. I believe these warnings are already
resolved by commit d70e46af7531 ("counter: Internalize sysfs interface
code") in the linux-next tree. Would you verify whether that is the case
or if we still need to fix this?
Sincerely,
William Breathitt Gray
> ---
> drivers/counter/stm32-lptimer-cnt.c | 2 +-
> drivers/counter/stm32-timer-cnt.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c
> index c19d998..6f1113a 100644
> --- a/drivers/counter/stm32-lptimer-cnt.c
> +++ b/drivers/counter/stm32-lptimer-cnt.c
> @@ -262,7 +262,7 @@ static ssize_t stm32_lptim_cnt_ceiling_read(struct counter_device *counter,
> {
> struct stm32_lptim_cnt *const priv = counter->priv;
>
> - return snprintf(buf, PAGE_SIZE, "%u\n", priv->ceiling);
> + return sysfs_emit(buf, "%u\n", priv->ceiling);
> }
>
> static ssize_t stm32_lptim_cnt_ceiling_write(struct counter_device *counter,
> diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
> index 603b30a..e772586 100644
> --- a/drivers/counter/stm32-timer-cnt.c
> +++ b/drivers/counter/stm32-timer-cnt.c
> @@ -173,7 +173,7 @@ static ssize_t stm32_count_ceiling_read(struct counter_device *counter,
>
> regmap_read(priv->regmap, TIM_ARR, &arr);
>
> - return snprintf(buf, PAGE_SIZE, "%u\n", arr);
> + return sysfs_emit(buf, "%u\n", arr);
> }
>
> static ssize_t stm32_count_ceiling_write(struct counter_device *counter,
> --
> 2.7.4
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists