Merge 3.8-rc5 into staging-next
[firefly-linux-kernel-4.4.55.git] / drivers / staging / sb105x / sb_pci_mp.c
index 9464f3874346eb141f115c65752b9bbe41fc4c7d..f75ee1dd475c6e1b9ead392a1e43e5ea6177747b 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;
@@ -2851,18 +2851,12 @@ static void __init multi_init_ports(void)
                                printk("IIR_RET = %x\n",b_ret);
                        }
 
-                       if(IIR_RS232 == (b_ret & IIR_RS232))
-                       {
-                               mtpt->interface = RS232;
-                       }
-                       if(IIR_RS422 == (b_ret & IIR_RS422))
-                       {
+                       /* default to RS232 */
+                       mtpt->interface = RS232;
+                       if (IIR_RS422 == (b_ret & IIR_TYPE_MASK))
                                mtpt->interface = RS422PTP;
-                       }
-                       if(IIR_RS485 == (b_ret & IIR_RS485))
-                       {
+                       if (IIR_RS485 == (b_ret & IIR_TYPE_MASK))
                                mtpt->interface = RS485NE;
-                       }
                }
        }
 }