mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: cgel.zte@gmail.com, jk@ozlabs.org
Cc: joel@jms.id.au, alistair@popple.id.au, eajames@linux.ibm.com,
	linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	Ye Guojin <ye.guojin@zte.com.cn>, Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] fsi: master: replace snprintf in show functions with sysfs_emit
Date: Thu, 21 Oct 2021 21:49:34 -0700	[thread overview]
Message-ID: <ccb3ab4d533de55260b98c7168bfa4460c5f3fcc.camel@perches.com> (raw)
In-Reply-To: <20211022025052.1063370-1-ye.guojin@zte.com.cn>

On Fri, 2021-10-22 at 02:50 +0000, cgel.zte@gmail.com wrote:
> From: Ye Guojin <ye.guojin@zte.com.cn>
> 
> coccicheck complains about the use of snprintf() in sysfs show
> functions:
> WARNING  use scnprintf or sprintf
[]
> diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c
[]
> @@ -1083,8 +1083,7 @@ static ssize_t external_mode_show(struct device *dev,
>  {
>  	struct fsi_master_acf *master = dev_get_drvdata(dev);
>  
> -	return snprintf(buf, PAGE_SIZE - 1, "%u\n",
> -			master->external_mode ? 1 : 0);
> +	return sysfs_emit(buf, "%u\n", master->external_mode ? 1 : 0);

external_mode is already bool so this ?: isn't necessary.

> diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
[]
> @@ -718,8 +718,7 @@ static ssize_t external_mode_show(struct device *dev,
>  {
>  	struct fsi_master_gpio *master = dev_get_drvdata(dev);
>  
> -	return snprintf(buf, PAGE_SIZE - 1, "%u\n",
> -			master->external_mode ? 1 : 0);
> +	return sysfs_emit(buf, "%u\n", master->external_mode ? 1 : 0);

here too


  reply	other threads:[~2021-10-22  4:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22  2:50 cgel.zte
2021-10-22  4:49 ` Joe Perches [this message]
2021-10-22  9:02   ` [PATCH v2] " cgel.zte

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=ccb3ab4d533de55260b98c7168bfa4460c5f3fcc.camel@perches.com \
    --to=joe@perches.com \
    --cc=alistair@popple.id.au \
    --cc=cgel.zte@gmail.com \
    --cc=eajames@linux.ibm.com \
    --cc=jk@ozlabs.org \
    --cc=joel@jms.id.au \
    --cc=linux-fsi@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ye.guojin@zte.com.cn \
    --cc=zealci@zte.com.cn \
    /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

all inboxes | Powered by JetHome®