Browse Source

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: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Alan Cox 15 years ago
parent
commit
c93f094021
1 changed files with 4 additions and 0 deletions
  1. 4 0
      drivers/net/caif/caif_serial.c

+ 4 - 0
drivers/net/caif/caif_serial.c

@@ -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);