Skip to content

Commit 13066c3

Browse files
committed
xtensa: ISS: don't use string pointer before NULL check
Move strlen call inside the if block that checks string pointer for NULL. While at it also fix the following coccicheck warning: ./arch/xtensa/platforms/iss/console.c:204:10-11: WARNING comparing pointer to 0. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
1 parent 43ba223 commit 13066c3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/xtensa/platforms/iss/console.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ late_initcall(rs_init);
186186

187187
static void iss_console_write(struct console *co, const char *s, unsigned count)
188188
{
189-
int len = strlen(s);
190-
191-
if (s != 0 && *s != 0)
189+
if (s && *s != 0) {
190+
int len = strlen(s);
192191
simc_write(1, s, count < len ? count : len);
192+
}
193193
}
194194

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

0 commit comments

Comments
 (0)