From 5fd84c3c9c2f7c6798e5412994285d5a96a341a0 Mon Sep 17 00:00:00 2001 From: Sebastian Siewior Date: Fri, 4 Jul 2008 09:59:56 -0700 Subject: [PATCH] --- yaml --- r: 98707 b: refs/heads/master c: 4b1295b0df28cffd40e6c6d7c4b88dec7af1eb76 h: refs/heads/master i: 98705: 229d08797b4cd4cc4a583440987617f1061e6c8c 98703: e4344dc8a12cb9d2b2989a536e47df5673fccbdc v: v3 --- [refs] | 2 +- trunk/drivers/spi/spidev.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index cc7bb0cc1bb3..e500c36f5ca6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bef67c5a7d3a9c45e091e36625c09c0c811e2672 +refs/heads/master: 4b1295b0df28cffd40e6c6d7c4b88dec7af1eb76 diff --git a/trunk/drivers/spi/spidev.c b/trunk/drivers/spi/spidev.c index 799337f7fde1..f5b60c70389b 100644 --- a/trunk/drivers/spi/spidev.c +++ b/trunk/drivers/spi/spidev.c @@ -167,14 +167,14 @@ spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) mutex_lock(&spidev->buf_lock); status = spidev_sync_read(spidev, count); - if (status == 0) { + if (status > 0) { unsigned long missing; - missing = copy_to_user(buf, spidev->buffer, count); - if (count && missing == count) + missing = copy_to_user(buf, spidev->buffer, status); + if (missing == status) status = -EFAULT; else - status = count - missing; + status = status - missing; } mutex_unlock(&spidev->buf_lock); @@ -200,8 +200,6 @@ spidev_write(struct file *filp, const char __user *buf, missing = copy_from_user(spidev->buffer, buf, count); if (missing == 0) { status = spidev_sync_write(spidev, count); - if (status == 0) - status = count; } else status = -EFAULT; mutex_unlock(&spidev->buf_lock);