aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2009-03-12 08:36:38 -0400
committerJean Delvare <khali@linux-fr.org>2009-03-12 08:36:38 -0400
commit3bb9db79235e19dbb18ba6f4a428a97c69115319 (patch)
treefdbd5f7157ff3c57c9981e118df00a3261a24f76 /drivers/hwmon
parentebdcc81c71937b30e09110c02a1e8a21fa770b6f (diff)
hwmon: (abituguru3) Fix I/O error handling
Fix a logic bug reported by Roel Kluin, by rewriting the error handling code in a clearer way. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Roel Kluin <roel.kluin@gmail.com> Acked-by: Alistair John Strachan <alistair@devzero.co.uk> Acked-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/abituguru3.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index e52b38806d03..ad2b3431b725 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -760,8 +760,11 @@ static int abituguru3_read_increment_offset(struct abituguru3_data *data,
760 760
761 for (i = 0; i < offset_count; i++) 761 for (i = 0; i < offset_count; i++)
762 if ((x = abituguru3_read(data, bank, offset + i, count, 762 if ((x = abituguru3_read(data, bank, offset + i, count,
763 buf + i * count)) != count) 763 buf + i * count)) != count) {
764 return i * count + (i && (x < 0)) ? 0 : x; 764 if (x < 0)
765 return x;
766 return i * count + x;
767 }
765 768
766 return i * count; 769 return i * count;
767} 770}