From: Jiri Slaby <jirislaby@kernel.org>
To: Thorsten Blum <thorsten.blum@toblux.com>
Cc: chris@zankel.net, gregkh@linuxfoundation.org, jcmvbkbc@gmail.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] tty: xtensa/iss: Use min() to fix Coccinelle warning
Date: Thu, 4 Apr 2024 10:11:14 +0200 [thread overview]
Message-ID: <593747f1-4256-4931-9d5c-50f1b68d3c2b@kernel.org> (raw)
In-Reply-To: <20240404075811.6936-3-thorsten.blum@toblux.com>
On 04. 04. 24, 9:58, Thorsten Blum wrote:
> Inline strlen() and use min() to fix the following Coccinelle/coccicheck
> warning reported by minmax.cocci:
>
> WARNING opportunity for min()
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Thanks.
> ---
> Changes in v2:
> - Use min() instead of umin() as suggested by Jiri Slaby
>
> Changes in v3:
> - Inline strlen() as suggested by Jiri Slaby
> ---
> arch/xtensa/platforms/iss/console.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
> index 8896e691c051..abec44b687df 100644
> --- a/arch/xtensa/platforms/iss/console.c
> +++ b/arch/xtensa/platforms/iss/console.c
> @@ -166,10 +166,8 @@ late_initcall(rs_init);
>
> static void iss_console_write(struct console *co, const char *s, unsigned count)
> {
> - if (s && *s != 0) {
> - int len = strlen(s);
> - simc_write(1, s, count < len ? count : len);
> - }
> + if (s && *s != 0)
> + simc_write(1, s, min(count, strlen(s)));
> }
>
> static struct tty_driver* iss_console_device(struct console *c, int *index)
--
js
suse labs
next prev parent reply other threads:[~2024-04-04 8:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 23:47 [PATCH] tty: xtensa/iss: Use umin() " Thorsten Blum
2024-04-04 2:10 ` Max Filippov
2024-04-04 5:05 ` Jiri Slaby
2024-04-04 7:35 ` Thorsten Blum
2024-04-04 7:38 ` [PATCH v2] tty: xtensa/iss: Use min() " Thorsten Blum
2024-04-04 7:41 ` Jiri Slaby
2024-04-04 7:58 ` [PATCH v3] " Thorsten Blum
2024-04-04 8:11 ` Jiri Slaby [this message]
2024-04-04 9:12 ` Max Filippov
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=593747f1-4256-4931-9d5c-50f1b68d3c2b@kernel.org \
--to=jirislaby@kernel.org \
--cc=chris@zankel.net \
--cc=gregkh@linuxfoundation.org \
--cc=jcmvbkbc@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=thorsten.blum@toblux.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
all inboxes | Powered by JetHome®