aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-pca963x.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c
index 35d56a62f92f..82589c0a5689 100644
--- a/drivers/leds/leds-pca963x.c
+++ b/drivers/leds/leds-pca963x.c
@@ -285,13 +285,13 @@ pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip)
285 u32 reg; 285 u32 reg;
286 int res; 286 int res;
287 287
288 res = of_property_read_u32(child, "reg", &reg);
289 if ((res != 0) || (reg >= chip->n_leds))
290 continue;
288 led.name = 291 led.name =
289 of_get_property(child, "label", NULL) ? : child->name; 292 of_get_property(child, "label", NULL) ? : child->name;
290 led.default_trigger = 293 led.default_trigger =
291 of_get_property(child, "linux,default-trigger", NULL); 294 of_get_property(child, "linux,default-trigger", NULL);
292 res = of_property_read_u32(child, "reg", &reg);
293 if (res != 0)
294 continue;
295 pca963x_leds[reg] = led; 295 pca963x_leds[reg] = led;
296 } 296 }
297 pdata = devm_kzalloc(&client->dev, 297 pdata = devm_kzalloc(&client->dev,
@@ -300,7 +300,7 @@ pca963x_dt_init(struct i2c_client *client, struct pca963x_chipdef *chip)
300 return ERR_PTR(-ENOMEM); 300 return ERR_PTR(-ENOMEM);
301 301
302 pdata->leds.leds = pca963x_leds; 302 pdata->leds.leds = pca963x_leds;
303 pdata->leds.num_leds = count; 303 pdata->leds.num_leds = chip->n_leds;
304 304
305 /* default to open-drain unless totem pole (push-pull) is specified */ 305 /* default to open-drain unless totem pole (push-pull) is specified */
306 if (of_property_read_bool(np, "nxp,totem-pole")) 306 if (of_property_read_bool(np, "nxp,totem-pole"))