aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>2017-12-22 11:31:38 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-09 10:37:03 -0500
commit8ca31ba8bb3441dd9928d2f92ffeee11dd2b6e63 (patch)
tree41cdaf226f3935728e4c4d95846a317d2702f39a
parent69c444ba93b76f2da4f23449c72e83521142b243 (diff)
tty: serial: jsm: Remove unnecessary NULL checks
After inspection made by Markus using Coccinelle software, he observed that we could possibly be triggering a NULL pointer dereference in 2 functions [0]. After discussion in mailing list, it was observed in fact we have two unnecessary checks for NULL pointer, and they were leading to Coccinelle warn. So, instead of reworking the code as proposed by him, we hereby remove the unnecessary checks, and also some unneeded extra lines in the code. These two unnecessary NULL checks were tracked in the call chain as never NULL, so they can be safely removed. No functional changes are intended. [0] https://lkml.org/lkml/2017/11/29/705 Suggested-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/jsm/jsm_neo.c3
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c6
2 files changed, 0 insertions, 9 deletions
diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index 4718560b8fdc..6fa9a54b2454 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -282,9 +282,6 @@ static void neo_copy_data_from_uart_to_queue(struct jsm_channel *ch)
282 u16 head; 282 u16 head;
283 u16 tail; 283 u16 tail;
284 284
285 if (!ch)
286 return;
287
288 /* cache head and tail of queue */ 285 /* cache head and tail of queue */
289 head = ch->ch_r_head & RQUEUEMASK; 286 head = ch->ch_r_head & RQUEUEMASK;
290 tail = ch->ch_r_tail & RQUEUEMASK; 287 tail = ch->ch_r_tail & RQUEUEMASK;
diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 469927d37b41..b6bd6e15e07b 100644
--- a/drivers/tty/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
@@ -523,9 +523,6 @@ void jsm_input(struct jsm_channel *ch)
523 523
524 jsm_dbg(READ, &ch->ch_bd->pci_dev, "start\n"); 524 jsm_dbg(READ, &ch->ch_bd->pci_dev, "start\n");
525 525
526 if (!ch)
527 return;
528
529 port = &ch->uart_port.state->port; 526 port = &ch->uart_port.state->port;
530 tp = port->tty; 527 tp = port->tty;
531 528
@@ -648,11 +645,8 @@ static void jsm_carrier(struct jsm_channel *ch)
648 int phys_carrier = 0; 645 int phys_carrier = 0;
649 646
650 jsm_dbg(CARR, &ch->ch_bd->pci_dev, "start\n"); 647 jsm_dbg(CARR, &ch->ch_bd->pci_dev, "start\n");
651 if (!ch)
652 return;
653 648
654 bd = ch->ch_bd; 649 bd = ch->ch_bd;
655
656 if (!bd) 650 if (!bd)
657 return; 651 return;
658 652