From 3d486e858208a88327e56ff0ce23f85373b3b0d8 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 1306f60..6f5bb8e 100644 --- a/it87.c +++ b/it87.c @@ -1977,7 +1977,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; }