If nvec_write_async() fails, return -1 in the relevant
parts of the PS2 driver.

Signed-off-by: Julian Andres Klode <[email protected]>
---
 drivers/staging/nvec/nvec_ps2.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index 67c7755..7721d4a 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -38,7 +38,8 @@ static struct nvec_ps2 ps2_dev;
 static int ps2_startstreaming(struct serio *ser_dev)
 {
        unsigned char buf[] = START_STREAMING;
-       nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
+       if (nvec_write_async(ps2_dev.nvec, buf, sizeof(buf)) < 0)
+               return -1;
        return 0;
 }
 
@@ -55,7 +56,8 @@ static int ps2_sendcommand(struct serio *ser_dev, unsigned 
char cmd)
        buf[2] = cmd & 0xff;
 
        dev_dbg(&ser_dev->dev, "Sending ps2 cmd %02x\n", cmd);
-       nvec_write_async(ps2_dev.nvec, buf, sizeof(buf));
+       if (nvec_write_async(ps2_dev.nvec, buf, sizeof(buf)) < 0)
+               return -1;
 
        return 0;
 }
-- 
1.7.5.4

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to