瀏覽代碼

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 <clchiou@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Dmitry Torokhov 13 年之前
父節點
當前提交
4fa0771138
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/input/serio/serio_raw.c

+ 1 - 1
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)