USB: serial: opticon: fix CTS retrieval at open
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / usb / serial / opticon.c
index 5f4b0cd0f6e9734193dac84ba23373f13e301d65..b93ab96573ef4f5c0ca8afb304b3d3e980d26138 100644 (file)
@@ -143,7 +143,7 @@ static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port)
        usb_clear_halt(port->serial->dev, port->read_urb->pipe);
 
        res = usb_serial_generic_open(tty, port);
-       if (!res)
+       if (res)
                return res;
 
        /* Request CTS line state, sometimes during opening the current
@@ -219,7 +219,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
 
        /* The conncected devices do not have a bulk write endpoint,
         * to transmit data to de barcode device the control endpoint is used */
-       dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
+       dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
        if (!dr) {
                dev_err(&port->dev, "out of memory\n");
                count = -ENOMEM;