staging: sb105x: move dereference under IS_ERR() check
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 9 Jan 2013 07:10:59 +0000 (10:10 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Jan 2013 00:43:20 +0000 (16:43 -0800)
Avoid dereverencing the ERR_PTR() by shifting the dereference down a
couple lines.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/sb105x/sb_pci_mp.c

index 131afd0c460c3ba2f82f7beb68d11c75b59cbbaa..c34ebff6bb043f4e032a90091956fa2cd64a7960 100644 (file)
@@ -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;