diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/leds/leds-lp5523.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 97994ffdc014..4ddf7b445a83 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c | |||
@@ -248,7 +248,10 @@ static int lp5523_configure(struct i2c_client *client) | |||
248 | 248 | ||
249 | /* Let the programs run for couple of ms and check the engine status */ | 249 | /* Let the programs run for couple of ms and check the engine status */ |
250 | usleep_range(3000, 6000); | 250 | usleep_range(3000, 6000); |
251 | lp5523_read(client, LP5523_REG_STATUS, &status); | 251 | ret = lp5523_read(client, LP5523_REG_STATUS, &status); |
252 | if (ret < 0) | ||
253 | return ret; | ||
254 | |||
252 | status &= LP5523_ENG_STATUS_MASK; | 255 | status &= LP5523_ENG_STATUS_MASK; |
253 | 256 | ||
254 | if (status == LP5523_ENG_STATUS_MASK) { | 257 | if (status == LP5523_ENG_STATUS_MASK) { |
@@ -464,10 +467,16 @@ static ssize_t lp5523_selftest(struct device *dev, | |||
464 | LP5523_EN_LEDTEST | 16); | 467 | LP5523_EN_LEDTEST | 16); |
465 | usleep_range(3000, 6000); /* ADC conversion time is typically 2.7 ms */ | 468 | usleep_range(3000, 6000); /* ADC conversion time is typically 2.7 ms */ |
466 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); | 469 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); |
470 | if (ret < 0) | ||
471 | goto fail; | ||
472 | |||
467 | if (!(status & LP5523_LEDTEST_DONE)) | 473 | if (!(status & LP5523_LEDTEST_DONE)) |
468 | usleep_range(3000, 6000); /* Was not ready. Wait little bit */ | 474 | usleep_range(3000, 6000); /* Was not ready. Wait little bit */ |
469 | 475 | ||
470 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &vdd); | 476 | ret = lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &vdd); |
477 | if (ret < 0) | ||
478 | goto fail; | ||
479 | |||
471 | vdd--; /* There may be some fluctuation in measurement */ | 480 | vdd--; /* There may be some fluctuation in measurement */ |
472 | 481 | ||
473 | for (i = 0; i < LP5523_LEDS; i++) { | 482 | for (i = 0; i < LP5523_LEDS; i++) { |
@@ -489,9 +498,14 @@ static ssize_t lp5523_selftest(struct device *dev, | |||
489 | /* ADC conversion time is 2.7 ms typically */ | 498 | /* ADC conversion time is 2.7 ms typically */ |
490 | usleep_range(3000, 6000); | 499 | usleep_range(3000, 6000); |
491 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); | 500 | ret = lp5523_read(chip->client, LP5523_REG_STATUS, &status); |
501 | if (ret < 0) | ||
502 | goto fail; | ||
503 | |||
492 | if (!(status & LP5523_LEDTEST_DONE)) | 504 | if (!(status & LP5523_LEDTEST_DONE)) |
493 | usleep_range(3000, 6000);/* Was not ready. Wait. */ | 505 | usleep_range(3000, 6000);/* Was not ready. Wait. */ |
494 | ret |= lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &adc); | 506 | ret = lp5523_read(chip->client, LP5523_REG_LED_TEST_ADC, &adc); |
507 | if (ret < 0) | ||
508 | goto fail; | ||
495 | 509 | ||
496 | if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM) | 510 | if (adc >= vdd || adc < LP5523_ADC_SHORTCIRC_LIM) |
497 | pos += sprintf(buf + pos, "LED %d FAIL\n", i); | 511 | pos += sprintf(buf + pos, "LED %d FAIL\n", i); |