Commit 8dd2c9e3 authored by Roel Kluin's avatar Roel Kluin Committed by Liam Girdwood

leds: Fix bounds checking of wm8350->pmic.led

Fix bounds checking of wm8350->pmic.led
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 9bf503e6
...@@ -1435,7 +1435,7 @@ int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink, ...@@ -1435,7 +1435,7 @@ int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
struct platform_device *pdev; struct platform_device *pdev;
int ret; int ret;
if (lednum > ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) { if (lednum >= ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) {
dev_err(wm8350->dev, "Invalid LED index %d\n", lednum); dev_err(wm8350->dev, "Invalid LED index %d\n", lednum);
return -ENODEV; return -ENODEV;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment