Flush worker earlier, resolving the last to-do item.
[elmcan.git] / module / elmcan.c
index 2fd861d54d1f5c248b0404e490abe4922102ac66..33b0add55e8adb2dc3ed28c6fee21a5654a55bff 100644 (file)
@@ -1215,14 +1215,14 @@ static void elmcan_ldisc_close(struct tty_struct *tty)
 
        /* At this point, all ldisc calls to us have become no-ops. */
 
+       flush_work(&elm->tx_work);
+
        /* Mark channel as dead */
        spin_lock_bh(&elm->lock);
        tty->disc_data = NULL;
        elm->tty = NULL;
        spin_unlock_bh(&elm->lock);
 
-       flush_work(&elm->tx_work);
-
        netdev_info(elm->dev, "elmcan off %s.\n", tty->name);
 
        kfree(elm->txbuf);