Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bb9db79 authored by Jean Delvare's avatar Jean Delvare
Browse files

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: default avatarJean Delvare <khali@linux-fr.org>
Cc: Roel Kluin <roel.kluin@gmail.com>
Acked-by: default avatarAlistair John Strachan <alistair@devzero.co.uk>
Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
parent ebdcc81c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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;
}