summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/aspeed-pwm-tacho.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/aspeed-pwm-tacho.c')
-rw-r--r--drivers/hwmon/aspeed-pwm-tacho.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c
index 33fb54845bf6..3d8239fd66ed 100644
--- a/drivers/hwmon/aspeed-pwm-tacho.c
+++ b/drivers/hwmon/aspeed-pwm-tacho.c
@@ -851,6 +851,8 @@ static int aspeed_create_fan(struct device *dev,
ret = of_property_read_u32(child, "reg", &pwm_port);
if (ret)
return ret;
+ if (pwm_port >= ARRAY_SIZE(pwm_port_params))
+ return -EINVAL;
aspeed_create_pwm_port(priv, (u8)pwm_port);
ret = of_property_count_u8_elems(child, "cooling-levels");