Return cleanly in functions calling elm327_hw_failure()
authornorly <ny-git@enpas.org>
Thu, 31 Jan 2019 00:49:33 +0000 (01:49 +0100)
committernorly <ny-git@enpas.org>
Thu, 31 Jan 2019 00:51:27 +0000 (01:51 +0100)
module/elmcan.c
readme.rst

index fee83c528d174b4a88feb68582d1aa53d4d8f795..854ff59ba647fe7cf01b980bde1a70daa343c574 100644 (file)
@@ -173,6 +173,7 @@ static void elm327_send(struct elmcan *elm, const void *buf, size_t len)
        if (actual < 0) {
                netdev_err(elm->dev, "Failed to write to tty %s.\n", elm->tty->name);
                elm327_hw_failure(elm);
+               return;
        }
 
        elm->txleft = len - actual;
@@ -678,6 +679,7 @@ static void elm327_parse_rxbuf(struct elmcan *elm)
                         */
                        pr_err("RX buffer overflow. Faulty ELM327 connected?\n");
                        elm327_hw_failure(elm);
+                       return;
                } else if (len == elm->rxfill) {
                        if (elm->state == ELM_RECEIVING
                                && elm->rxbuf[elm->rxfill - 1] == ELM327_READY_CHAR) {
@@ -983,6 +985,8 @@ static void elmcan_ldisc_tx_worker(struct work_struct *work)
        if (actual < 0) {
                netdev_err(elm->dev, "Failed to write to tty %s.\n", elm->tty->name);
                elm327_hw_failure(elm);
+               spin_unlock_bh(&elm->lock);
+               return;
        }
 
        elm->txleft -= actual;
index d9eb5c17bd63ad1bb5d15bb5484a53f76b4495fc..7f708a1aa738f6e30f7821407e40d02d61fa217d 100644 (file)
@@ -260,8 +260,6 @@ incomplete) data frame::
 To Do list for future development
 ----------------------------------
 
-- Stop current function when in ``elm327_panic()``
-
 - DMA capable rx/tx buffers
 
 - flushing of ``tx_work`` is too late in ``ldisc_close()``