]> git.sur5r.net Git - groeck-it87/commitdiff
auto-adjust loop threshold to changes in the array size
authorairbjorn <gerhart@posteo.de>
Wed, 13 Jun 2018 09:04:40 +0000 (11:04 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 13 Jun 2018 21:37:44 +0000 (14:37 -0700)
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
it87.c

diff --git a/it87.c b/it87.c
index 75c4e34ad02ee615f7b9b79b2df2735657fd8346..79bf6b14c0696772762cdbd4005c9fa4d7757501 100644 (file)
--- 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;
        }