From bfbaf881f5bc1462b51e1b0296dba70d0b150515 Mon Sep 17 00:00:00 2001 From: airbjorn Date: Wed, 13 Jun 2018 11:04:40 +0200 Subject: [PATCH] auto-adjust loop threshold to changes in the array size Signed-off-by: Guenter Roeck --- it87.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.39.5