summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/jsm/jsm_tty.c
diff options
context:
space:
mode:
authorGuilherme G. Piccoli2017-12-22 17:31:38 +0100
committerGreg Kroah-Hartman2018-01-09 16:37:03 +0100
commit8ca31ba8bb3441dd9928d2f92ffeee11dd2b6e63 (patch)
tree41cdaf226f3935728e4c4d95846a317d2702f39a /drivers/tty/serial/jsm/jsm_tty.c
parentMerge 4.15-rc6 into tty-next (diff)
downloadkernel-qcow2-linux-8ca31ba8bb3441dd9928d2f92ffeee11dd2b6e63.tar.gz
kernel-qcow2-linux-8ca31ba8bb3441dd9928d2f92ffeee11dd2b6e63.tar.xz
kernel-qcow2-linux-8ca31ba8bb3441dd9928d2f92ffeee11dd2b6e63.zip
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>
Diffstat (limited to 'drivers/tty/serial/jsm/jsm_tty.c')
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c6
1 files changed, 0 insertions, 6 deletions
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)
jsm_dbg(READ, &ch->ch_bd->pci_dev, "start\n");
- if (!ch)
- return;
-
port = &ch->uart_port.state->port;
tp = port->tty;
@@ -648,11 +645,8 @@ static void jsm_carrier(struct jsm_channel *ch)
int phys_carrier = 0;
jsm_dbg(CARR, &ch->ch_bd->pci_dev, "start\n");
- if (!ch)
- return;
bd = ch->ch_bd;
-
if (!bd)
return;