From 4fa0771138d0b56fe59ab8ab3b1ce9e594484362 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 10 Jan 2012 00:45:12 -0800 Subject: Input: serio_raw - return proper result when serio_raw_write fails If serio_raw_write was always returning number of bytes successfully sent to serio port and never signalled error condition to the caller. Change it so that for completely failed transfers appropriate error code returned to the caller (partially successful writes still return number of bytes transferred). Reported-by: Che-liang Chiou Signed-off-by: Dmitry Torokhov --- drivers/input/serio/serio_raw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index f6c83e9ecff..8250299fd64 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c @@ -224,7 +224,7 @@ static ssize_t serio_raw_write(struct file *file, const char __user *buffer, out: mutex_unlock(&serio_raw_mutex); - return written; + return written ?: retval; } static unsigned int serio_raw_poll(struct file *file, poll_table *wait) -- cgit v1.2.3-70-g09d2