From: Thorsten Blum <thorsten.blum@toblux.com>
To: Chris Zankel <chris@zankel.net>, Max Filippov <jcmvbkbc@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Jiri Slaby (SUSE)" <jirislaby@kernel.org>,
linux-kernel@vger.kernel.org,
Thorsten Blum <thorsten.blum@toblux.com>
Subject: [PATCH] tty: xtensa/iss: Use umin() to fix Coccinelle warning
Date: Thu, 4 Apr 2024 01:47:30 +0200 [thread overview]
Message-ID: <20240403234729.175168-2-thorsten.blum@toblux.com> (raw)
Use unsigned size_t to improve len data type and umin() to fix the
following Coccinelle/coccicheck warning reported by minmax.cocci:
WARNING opportunity for min()
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
arch/xtensa/platforms/iss/console.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 8896e691c051..b493fc50933d 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -167,8 +167,9 @@ 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);
+ size_t len = strlen(s);
+
+ simc_write(1, s, umin(count, len));
}
}
--
2.44.0
next reply other threads:[~2024-04-03 23:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 23:47 Thorsten Blum [this message]
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
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=20240403234729.175168-2-thorsten.blum@toblux.com \
--to=thorsten.blum@toblux.com \
--cc=chris@zankel.net \
--cc=gregkh@linuxfoundation.org \
--cc=jcmvbkbc@gmail.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®