Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c93f0940 authored by Alan Cox's avatar Alan Cox Committed by David S. Miller
Browse files

caif: check write operations



write is optional for a tty device. Check that we have a write op rather
than calling NULL.

Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 298b9e44
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -312,6 +312,10 @@ static int ldisc_open(struct tty_struct *tty)
	char name[64];
	int result;

	/* No write no play */
	if (tty->ops->write == NULL)
		return -EOPNOTSUPP;

	sprintf(name, "cf%s", tty->name);
	dev = alloc_netdev(sizeof(*ser), name, caifdev_setup);
	ser = netdev_priv(dev);