Skip to content

Commit

Permalink
caif: check write operations
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alan Cox authored and David S. Miller committed Apr 7, 2010
1 parent 298b9e4 commit c93f094
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/caif/caif_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c93f094

Please sign in to comment.