Skip to content

Commit 11cca8c

Browse files
tobluxjcmvbkbc
authored andcommitted
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 <[email protected]> Message-Id: <[email protected]> Reviewed-by: Jiri Slaby <[email protected]> Signed-off-by: Max Filippov <[email protected]>
1 parent 0e60f0b commit 11cca8c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/xtensa/platforms/iss/console.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,8 @@ late_initcall(rs_init);
166166

167167
static void iss_console_write(struct console *co, const char *s, unsigned count)
168168
{
169-
if (s && *s != 0) {
170-
int len = strlen(s);
171-
simc_write(1, s, count < len ? count : len);
172-
}
169+
if (s && *s != 0)
170+
simc_write(1, s, min(count, strlen(s)));
173171
}
174172

175173
static struct tty_driver* iss_console_device(struct console *c, int *index)

0 commit comments

Comments
 (0)