Skip to content

Commit

Permalink
hwmon: (abituguru3) Fix I/O error handling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare committed Mar 12, 2009
1 parent ebdcc81 commit 3bb9db7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/hwmon/abituguru3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3bb9db7

Please sign in to comment.