linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: cgel.zte@gmail.com
Cc: joe@perches.com, andrew@aj.id.au, fancer.lancer@gmail.com,
	gregkh@linuxfoundation.org, jirislaby@kernel.org,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	macro@orcam.me.uk, pali@kernel.org, yao.jing2@zte.com.cn,
	zealci@zte.com.cn
Subject: Re: [PATCH v2] drivers: tty: replace snprintf in show functions with sysfs_emit
Date: Tue, 2 Nov 2021 08:44:19 +0100	[thread overview]
Message-ID: <YYDsU778y71byGdj@hovoldconsulting.com> (raw)
In-Reply-To: <20211102065206.3368-1-yao.jing2@zte.com.cn>

On Tue, Nov 02, 2021 at 06:52:06AM +0000, cgel.zte@gmail.com wrote:
> From: Jing Yao <yao.jing2@zte.com.cn>
> 
> coccicheck complains about the use of snprintf() in sysfs show
> functions:
> 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: Jing Yao <yao.jing2@zte.com.cn>
> ---

What changed since v1? Always include a changelog here.

Also you ignored my comment on the patch Subject. Including "drivers: "
is never correct. You should also mention which driver you're changing
since it's not done subtree-wide for tty. 

Again, look at the git log for the driver you're changing. In this case
it should have been something like:

	serial: 8250: use sysfs_emit...

>  drivers/tty/serial/8250/8250_port.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 5775cbff8f6e..3d58f383152e 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -3099,7 +3099,7 @@ static ssize_t rx_trig_bytes_show(struct device *dev,
>  	if (rxtrig_bytes < 0)
>  		return rxtrig_bytes;
>  
> -	return snprintf(buf, PAGE_SIZE, "%d\n", rxtrig_bytes);
> +	return sysfs_emit(buf, "%d\n", rxtrig_bytes);
>  }
>  
>  static int do_set_rxtrig(struct tty_port *port, unsigned char bytes)

Johan

  reply	other threads:[~2021-11-02  7:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 10:13 [PATCH] drivers: tty: replace snprintf in show functions with sysfs_emit cgel.zte
2021-10-28 12:22 ` Johan Hovold
2021-10-28 12:49   ` Maciej W. Rozycki
2021-10-28 20:57 ` kernel test robot
2021-10-28 23:49 ` kernel test robot
2021-10-29  5:44 ` Greg KH
2021-10-31 15:34   ` Joe Perches
2021-11-02  6:52     ` [PATCH v2] " cgel.zte
2021-11-02  7:44       ` Johan Hovold [this message]
2021-11-04 11:47         ` [PATCH v3] serial: 8250: " cgel.zte
2021-11-08  9:54           ` Johan Hovold

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=YYDsU778y71byGdj@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=andrew@aj.id.au \
    --cc=cgel.zte@gmail.com \
    --cc=fancer.lancer@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=pali@kernel.org \
    --cc=yao.jing2@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;
as well as URLs for NNTP newsgroup(s).