summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authornorly <ny-git@enpas.org>2019-01-23 16:37:39 +0100
committernorly <ny-git@enpas.org>2019-01-23 16:41:34 +0100
commit4773fcf3beb4375a6663fbe79de1d9160c294069 (patch)
tree5018a4d24cf79cba67b5ffcc33831ff698db9b84 /module
parent93b5d3d7b9687d3bae6dca2d2e0464ad3a68c8ae (diff)
Handle tty->ops->write() returning error
This was already the case in elmcan_ldisc_tx_worker(), but was missing in elm327_send().
Diffstat (limited to 'module')
-rw-r--r--module/elmcan.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/module/elmcan.c b/module/elmcan.c
index e455202..cde48ca 100644
--- a/module/elmcan.c
+++ b/module/elmcan.c
@@ -137,6 +137,8 @@ struct elmcan {
static DEFINE_SPINLOCK(elmcan_discdata_lock);
+static inline void elm327_panic(struct elmcan *elm);
+
/************************************************************************
@@ -161,6 +163,11 @@ static void elm327_send(struct elmcan *elm, const void *buf, size_t len)
*/
set_bit(TTY_DO_WRITE_WAKEUP, &elm->tty->flags);
actual = elm->tty->ops->write(elm->tty, elm->txbuf, len);
+ if (actual < 0) {
+ pr_err("Failed to write to tty for %s.\n", elm->dev->name);
+ elm327_panic(elm);
+ }
+
elm->txleft = len - actual;
elm->txhead = elm->txbuf + actual;
}