summaryrefslogtreecommitdiffstats
path: root/drivers/char/stallion.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-07-22 11:18:43 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 13:03:28 -0700
commit4a56122297ac7a4a3bf09fb66c0a365a13abe707 (patch)
tree2b748f15c805c3e6e8e5cb6a349e807edf52d909 /drivers/char/stallion.c
parent781cff5cb2bc8d714270accf88db23a855de9816 (diff)
downloadlinux-4a56122297ac7a4a3bf09fb66c0a365a13abe707.tar.gz
linux-4a56122297ac7a4a3bf09fb66c0a365a13abe707.tar.bz2
linux-4a56122297ac7a4a3bf09fb66c0a365a13abe707.zip
Fix the (i)Stallion driver's putchar() and break_ctl() ops
Fix the Stallion driver's putchar() and break_ctl() ops and iStallion's putchar() to return values. Is it actually possible for putchar() or break_ctl() to be called with tty == NULL or can the check be discarded? Should stl_write() be returning 0 if tty->driver_data is NULL or tx.buf is NULL? Is this even possible? I've made Stallion's functions return -EINVAL as stli_breakctl() if the checks fail. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/stallion.c')
-rw-r--r--drivers/char/stallion.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 0243efb0be95..de5a725c3cc0 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -1025,7 +1025,7 @@ static int stl_write(struct tty_struct *tty, const unsigned char *buf, int count
/*****************************************************************************/
-static void stl_putchar(struct tty_struct *tty, unsigned char ch)
+static int stl_putchar(struct tty_struct *tty, unsigned char ch)
{
struct stlport *portp;
unsigned int len;
@@ -1034,12 +1034,12 @@ static void stl_putchar(struct tty_struct *tty, unsigned char ch)
pr_debug("stl_putchar(tty=%p,ch=%x)\n", tty, ch);
if (tty == NULL)
- return;
+ return -EINVAL;
portp = tty->driver_data;
if (portp == NULL)
- return;
+ return -EINVAL;
if (portp->tx.buf == NULL)
- return;
+ return -EINVAL;
head = portp->tx.head;
tail = portp->tx.tail;
@@ -1053,6 +1053,7 @@ static void stl_putchar(struct tty_struct *tty, unsigned char ch)
head = portp->tx.buf;
}
portp->tx.head = head;
+ return 0;
}
/*****************************************************************************/
@@ -1460,19 +1461,20 @@ static void stl_hangup(struct tty_struct *tty)
/*****************************************************************************/
-static void stl_breakctl(struct tty_struct *tty, int state)
+static int stl_breakctl(struct tty_struct *tty, int state)
{
struct stlport *portp;
pr_debug("stl_breakctl(tty=%p,state=%d)\n", tty, state);
if (tty == NULL)
- return;
+ return -EINVAL;
portp = tty->driver_data;
if (portp == NULL)
- return;
+ return -EINVAL;
stl_sendbreak(portp, ((state == -1) ? 1 : 2));
+ return 0;
}
/*****************************************************************************/