tty: serial/68328serial.c: remove unnecessary null pointer check
PATCH 1/1 tty: serial/crisv10.c: remove unnecessary null pointer check
In reply to Cong DingThe pointer tty is dereferened in line 3135, so it is not necessary to check null again in line 3140.
--- drivers/tty/serial/crisv10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/crisv10.c +1 -1
@@ -3137,7 +3137,7 @@ static int rs_raw_write(struct tty_struct *tty,/* first some sanity checks */ -if (!tty || !info->xmit.buf) +if (!info->xmit.buf)return 0 ;#ifdef SERIAL_DEBUG_DATA
Signature · 1 line
1.7.10.4
PATCH 1/1 tty: serial/68328serial.c: remove unnecessary null pointer check
The pointer info is dereferened in line 1009, so it is not necessary to check null again in line 1012.
--- drivers/tty/serial/68328serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/68328serial.c +1 -1
@@ -1009,7 +1009,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)m68328_uart *uart = &uart_addr[info->line];unsigned long flags; -if (!info ||serial_paranoia_check (info, tty->name,"rs_close" )) +if (serial_paranoia_check (info, tty->name,"rs_close" ))return ;local_irq_save (flags);
Signature · 1 line
1.7.10.4
Re: [PATCH] tty: serial/crisv10.c: remove unnecessary null pointer check
In reply to Cong DingQuoted 2 lines · Cong Ding
The pointer tty is dereferened in line 3135, so it is not necessary to check null again in line 3140.
I don't know if we actually need to check the parameter tty from being null, but when checking the rest of the file, most other functions don't check it.
In any case, gcc is quite likely to remove that check due to the earlier dereference, so removing it is probably acceptable.
Quoted 1 line
Signed-off-by Cong Ding <[email protected]>
Thanks, I'll take it in the CRIS tree.
/^JN - Jesper Nilsson
Signature · 1 line
Jesper Nilsson -- [email protected]
Re: [PATCH] tty: serial/crisv10.c: remove unnecessary null pointer check
Quoted 6 lines · Jesper Nilsson
Quoted 2 lines · Cong Ding
The pointer tty is dereferened in line 3135, so it is not necessary to check null again in line 3140.
I don't know if we actually need to check the parameter tty from being null, but when checking the rest of the file, most other functions don't check it.
Yes, the check in unneeded.
thanks,
Signature · 2 lines
js suse labs