diff options
author | Thorsten Blum <thorsten.blum@toblux.com> | 2024-04-04 09:58:13 +0200 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2024-04-04 11:10:44 +0200 |
commit | 11cca8ccf2c3643d002e7b421acfdc847a627e9f (patch) | |
tree | bffbb14d16d5bed92b8089139682a0a3818d1d30 /arch/xtensa | |
parent | xtensa: fix MAKE_PC_FROM_RA second argument (diff) | |
download | linux-11cca8ccf2c3643d002e7b421acfdc847a627e9f.tar.xz linux-11cca8ccf2c3643d002e7b421acfdc847a627e9f.zip |
tty: xtensa/iss: Use min() to fix Coccinelle warning
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>
Message-Id: <20240404075811.6936-3-thorsten.blum@toblux.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa')
-rw-r--r-- | arch/xtensa/platforms/iss/console.c | 6 |
1 files 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) |