From: airbjorn Date: Wed, 13 Jun 2018 09:04:40 +0000 (+0200) Subject: auto-adjust loop threshold to changes in the array size X-Git-Url: https://git.sur5r.net/?p=groeck-it87;a=commitdiff_plain;h=bfbaf881f5bc1462b51e1b0296dba70d0b150515 auto-adjust loop threshold to changes in the array size Signed-off-by: Guenter Roeck --- diff --git a/it87.c b/it87.c index 75c4e34..79bf6b1 100644 --- a/it87.c +++ b/it87.c @@ -1982,7 +1982,7 @@ static ssize_t set_pwm_freq(struct device *dev, struct device_attribute *attr, val *= has_newer_autopwm(data) ? 256 : 128; /* Search for the nearest available frequency */ - for (i = 0; i < 7; i++) { + for (i = 0; i < ARRAY_SIZE(pwm_freq) - 1; i++) { if (val > (pwm_freq[i] + pwm_freq[i + 1]) / 2) break; }