]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/tty.h
memcg, slab: do not destroy children caches if parent has aliases
[karo-tx-linux.git] / include / linux / tty.h
index b90b5c221ff0dca677bfed63cb36a404f258ec4d..1c3316a47d7e0386d1ede163c4f795275efc8130 100644 (file)
@@ -518,9 +518,9 @@ extern void tty_port_put(struct tty_port *port);
 
 static inline struct tty_port *tty_port_get(struct tty_port *port)
 {
-       if (port)
-               kref_get(&port->kref);
-       return port;
+       if (port && kref_get_unless_zero(&port->kref))
+               return port;
+       return NULL;
 }
 
 /* If the cts flow control is enabled, return true. */