diff options
author | Alan Cox <alan@linux.intel.com> | 2010-04-07 19:49:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-07 19:49:31 -0400 |
commit | c93f09402106f22601838ee2bb0d02bae934b5e5 (patch) | |
tree | 5e8471a9bcdbf63e170380163a987b51f82719d7 /drivers/net/caif | |
parent | 298b9e44be9592e94c0e69a5d3893cd11f5484fa (diff) |
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>
Diffstat (limited to 'drivers/net/caif')
-rw-r--r-- | drivers/net/caif/caif_serial.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c index 3502f607117f..c669ec37483b 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) | |||
312 | char name[64]; | 312 | char name[64]; |
313 | int result; | 313 | int result; |
314 | 314 | ||
315 | /* No write no play */ | ||
316 | if (tty->ops->write == NULL) | ||
317 | return -EOPNOTSUPP; | ||
318 | |||
315 | sprintf(name, "cf%s", tty->name); | 319 | sprintf(name, "cf%s", tty->name); |
316 | dev = alloc_netdev(sizeof(*ser), name, caifdev_setup); | 320 | dev = alloc_netdev(sizeof(*ser), name, caifdev_setup); |
317 | ser = netdev_priv(dev); | 321 | ser = netdev_priv(dev); |