summaryrefslogtreecommitdiffstats
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-12-02 13:56:03 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-08 16:56:05 -0800
commit82f91fe092b6eacd82e976b8955443f9fd97d07e (patch)
tree42b967f676e8054a222e58521024babe250b88c9 /drivers/input/serio
parent6c67716d64103e5a8e23c45dcdfc76520033d479 (diff)
downloadop-kernel-dev-82f91fe092b6eacd82e976b8955443f9fd97d07e.zip
op-kernel-dev-82f91fe092b6eacd82e976b8955443f9fd97d07e.tar.gz
tty: Always handle NULL flag ptr
Most line disciplines already handle the undocumented NULL flag ptr in their .receive_buf method; however, several don't. Document the NULL flag ptr, and correct handling in the N_MOUSE, N_GSM0710 and N_R394 line disciplines. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/serport.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c
index 8755f5f..0cb7ef5 100644
--- a/drivers/input/serio/serport.c
+++ b/drivers/input/serio/serport.c
@@ -124,7 +124,7 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c
{
struct serport *serport = (struct serport*) tty->disc_data;
unsigned long flags;
- unsigned int ch_flags;
+ unsigned int ch_flags = 0;
int i;
spin_lock_irqsave(&serport->lock, flags);
@@ -133,18 +133,20 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c
goto out;
for (i = 0; i < count; i++) {
- switch (fp[i]) {
- case TTY_FRAME:
- ch_flags = SERIO_FRAME;
- break;
-
- case TTY_PARITY:
- ch_flags = SERIO_PARITY;
- break;
-
- default:
- ch_flags = 0;
- break;
+ if (fp) {
+ switch (fp[i]) {
+ case TTY_FRAME:
+ ch_flags = SERIO_FRAME;
+ break;
+
+ case TTY_PARITY:
+ ch_flags = SERIO_PARITY;
+ break;
+
+ default:
+ ch_flags = 0;
+ break;
+ }
}
serio_interrupt(serport->serio, cp[i], ch_flags);
OpenPOWER on IntegriCloud