From: Dan Carpenter Date: Wed, 9 Jan 2013 07:10:59 +0000 (+0300) Subject: staging: sb105x: move dereference under IS_ERR() check X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=8441bf5e063e03e5d307ffb32fd5f77e81c0d397;p=linux-edison.git staging: sb105x: move dereference under IS_ERR() check Avoid dereverencing the ERR_PTR() by shifting the dereference down a couple lines. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/sb105x/sb_pci_mp.c b/drivers/staging/sb105x/sb_pci_mp.c index 131afd0c460..c34ebff6bb0 100644 --- a/drivers/staging/sb105x/sb_pci_mp.c +++ b/drivers/staging/sb105x/sb_pci_mp.c @@ -1563,13 +1563,13 @@ static int mp_open(struct tty_struct *tty, struct file *filp) state = uart_get(drv, line); - mtpt = (struct mp_port *)state->port; - if (IS_ERR(state)) { retval = PTR_ERR(state); goto fail; } + mtpt = (struct mp_port *)state->port; + tty->driver_data = state; tty->low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0; tty->alt_speed = 0;