From: Jean Delvare Date: Thu, 12 Mar 2009 12:36:38 +0000 (+0100) Subject: hwmon: (abituguru3) Fix I/O error handling X-Git-Tag: v2.6.29-rc8~5^2~3 X-Git-Url: http://ftp.safe.ca/?p=safe%2Fjmp%2Flinux-2.6;a=commitdiff_plain;h=3bb9db79235e19dbb18ba6f4a428a97c69115319 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 Cc: Roel Kluin Acked-by: Alistair John Strachan Acked-by: Hans de Goede --- diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index e52b388..ad2b343 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, for (i = 0; i < offset_count; i++) if ((x = abituguru3_read(data, bank, offset + i, count, - buf + i * count)) != count) - return i * count + (i && (x < 0)) ? 0 : x; + buf + i * count)) != count) { + if (x < 0) + return x; + return i * count + x; + } return i * count; }