]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/tty/serial/serial_core.c
Merge tag 'sound-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[karo-tx-linux.git] / drivers / tty / serial / serial_core.c
index f2303f390345e14664f31976662f7c804fbbb9d9..9939c3d9912b3563d107e3cd4439212e291377c3 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/mutex.h>
 
 #include <asm/irq.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 
 /*
  * This is used to lock changes in serial line configuration.
@@ -73,7 +73,7 @@ static inline struct uart_port *uart_port_ref(struct uart_state *state)
 
 static inline void uart_port_deref(struct uart_port *uport)
 {
-       if (uport && atomic_dec_and_test(&uport->state->refcount))
+       if (atomic_dec_and_test(&uport->state->refcount))
                wake_up(&uport->state->remove_wait);
 }
 
@@ -88,9 +88,10 @@ static inline void uart_port_deref(struct uart_port *uport)
 #define uart_port_unlock(uport, flags)                                 \
        ({                                                              \
                struct uart_port *__uport = uport;                      \
-               if (__uport)                                            \
+               if (__uport) {                                          \
                        spin_unlock_irqrestore(&__uport->lock, flags);  \
-               uart_port_deref(__uport);                               \
+                       uart_port_deref(__uport);                       \
+               }                                                       \
        })
 
 static inline struct uart_port *uart_port_check(struct uart_state *state)
@@ -1515,7 +1516,10 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
        unsigned long char_time, expire;
 
        port = uart_port_ref(state);
-       if (!port || port->type == PORT_UNKNOWN || port->fifosize == 0) {
+       if (!port)
+               return;
+
+       if (port->type == PORT_UNKNOWN || port->fifosize == 0) {
                uart_port_deref(port);
                return;
        }
@@ -2365,9 +2369,10 @@ static int uart_poll_get_char(struct tty_driver *driver, int line)
 
        if (state) {
                port = uart_port_ref(state);
-               if (port)
+               if (port) {
                        ret = port->ops->poll_get_char(port);
-               uart_port_deref(port);
+                       uart_port_deref(port);
+               }
        }
        return ret;
 }