From: Roel Kluin Date: Tue, 22 Sep 2009 23:43:41 +0000 (-0700) Subject: dme1737: Keep index within pwm_config[] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=912e837aef72a3dd263dafc3717d92bbc1211a53;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git dme1737: Keep index within pwm_config[] The static code scanner "Parfait" reported this because pwm_config is only 3 bytes - pwm_config[3] is out of range. Since this code path is never called with ix == 3 (the device has no PWM4 output) this doesn't change anything in practice. But to encourage testing with Parfait, lets make the warning go away... Signed-off-by: Roel Kluin Acked-by: Jean Delvare Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index 9814d51b3af4..2c2cb1ec94c5 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c @@ -1134,7 +1134,7 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *attr, res = PWM_FREQ_FROM_REG(data->pwm_freq[ix]); break; case SYS_PWM_ENABLE: - if (ix > 3) { + if (ix >= 3) { res = 1; /* pwm[5-6] hard-wired to manual mode */ } else { res = PWM_EN_FROM_REG(data->pwm_config[ix]);