summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-10-16 15:06:19 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-23 11:24:24 +0200
commitdee7d0f3b200c67c6ee96bd37c6e8fa52690ab56 (patch)
treeee2a31fe81e517700e4f516597b10fbc8c45a3b4 /drivers/tty
parent2a71de2f7366fb1aec632116d0549ec56d6a3940 (diff)
downloadop-kernel-dev-dee7d0f3b200c67c6ee96bd37c6e8fa52690ab56.zip
op-kernel-dev-dee7d0f3b200c67c6ee96bd37c6e8fa52690ab56.tar.gz
serdev: ttyport: enforce tty-driver open() requirement
The tty-driver open routine is mandatory, but the serdev tty-port-controller implementation did not treat it as such and would instead fall back to calling tty_port_open() directly. Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serdev/serdev-ttyport.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
index 302018d..404f3fd 100644
--- a/drivers/tty/serdev/serdev-ttyport.c
+++ b/drivers/tty/serdev/serdev-ttyport.c
@@ -102,10 +102,10 @@ static int ttyport_open(struct serdev_controller *ctrl)
return PTR_ERR(tty);
serport->tty = tty;
- if (tty->ops->open)
- tty->ops->open(serport->tty, NULL);
- else
- tty_port_open(serport->port, tty, NULL);
+ if (!tty->ops->open)
+ goto err_unlock;
+
+ tty->ops->open(serport->tty, NULL);
/* Bring the UART into a known 8 bits no parity hw fc state */
ktermios = tty->termios;
@@ -122,6 +122,12 @@ static int ttyport_open(struct serdev_controller *ctrl)
tty_unlock(serport->tty);
return 0;
+
+err_unlock:
+ tty_unlock(tty);
+ tty_release_struct(tty, serport->tty_idx);
+
+ return -ENODEV;
}
static void ttyport_close(struct serdev_controller *ctrl)
OpenPOWER on IntegriCloud