int txleft; /* Bytes left to TX */
/* TTY RX helpers */
- unsigned char *rxbuf;
+ unsigned char rxbuf[ELM327_SIZE_RXBUF];
int rxfill;
/* State machine */
return -ENFILE;
elm = netdev_priv(dev);
- elm->rxbuf = kmalloc(ELM327_SIZE_RXBUF, GFP_KERNEL);
elm->txbuf = kmalloc(ELM327_SIZE_TXBUF, GFP_KERNEL);
- if (!elm->rxbuf || !elm->txbuf) {
+ if (!elm->txbuf) {
err = -ENOMEM;
goto out_err;
}
out_err:
if (elm->txbuf)
kfree(elm->txbuf);
- if (elm->rxbuf)
- kfree(elm->rxbuf);
free_candev(elm->dev);
return err;
}
/* 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);
- kfree(elm->rxbuf);
free_candev(elm->dev);
}