From: Alan Cox Date: Wed, 7 Apr 2010 23:49:31 +0000 (-0700) Subject: caif: check write operations X-Git-Tag: v2.6.35-rc1~473^2~543 X-Git-Url: http://ftp.safe.ca/?p=safe%2Fjmp%2Flinux-2.6;a=commitdiff_plain;h=c93f09402106f22601838ee2bb0d02bae934b5e5 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 3502f60..c669ec3 100644 --- a/drivers/net/caif/caif_serial.c +++ b/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);