]> git.sur5r.net Git - groeck-it87/blobdiff - it87.c
auto-adjust loop threshold to changes in the array size
[groeck-it87] / 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;
        }