diff options
Diffstat (limited to 'drivers/leds/leds-lp5521.c')
-rw-r--r-- | drivers/leds/leds-lp5521.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 966f158a07db..cb8a5220200b 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c | |||
@@ -152,7 +152,7 @@ static int lp5521_read(struct i2c_client *client, u8 reg, u8 *buf) | |||
152 | 152 | ||
153 | ret = i2c_smbus_read_byte_data(client, reg); | 153 | ret = i2c_smbus_read_byte_data(client, reg); |
154 | if (ret < 0) | 154 | if (ret < 0) |
155 | return -EIO; | 155 | return ret; |
156 | 156 | ||
157 | *buf = ret; | 157 | *buf = ret; |
158 | return 0; | 158 | return 0; |
@@ -616,7 +616,7 @@ static ssize_t store_led_pattern(struct device *dev, | |||
616 | unsigned long val; | 616 | unsigned long val; |
617 | int ret; | 617 | int ret; |
618 | 618 | ||
619 | ret = strict_strtoul(buf, 16, &val); | 619 | ret = kstrtoul(buf, 16, &val); |
620 | if (ret) | 620 | if (ret) |
621 | return ret; | 621 | return ret; |
622 | 622 | ||
@@ -788,10 +788,17 @@ static int lp5521_probe(struct i2c_client *client, | |||
788 | * LP5521_REG_ENABLE register will not have any effect - strange! | 788 | * LP5521_REG_ENABLE register will not have any effect - strange! |
789 | */ | 789 | */ |
790 | ret = lp5521_read(client, LP5521_REG_R_CURRENT, &buf); | 790 | ret = lp5521_read(client, LP5521_REG_R_CURRENT, &buf); |
791 | if (ret || buf != LP5521_REG_R_CURR_DEFAULT) { | 791 | if (ret) { |
792 | dev_err(&client->dev, "error in resetting chip\n"); | 792 | dev_err(&client->dev, "error in resetting chip\n"); |
793 | goto fail2; | 793 | goto fail2; |
794 | } | 794 | } |
795 | if (buf != LP5521_REG_R_CURR_DEFAULT) { | ||
796 | dev_err(&client->dev, | ||
797 | "unexpected data in register (expected 0x%x got 0x%x)\n", | ||
798 | LP5521_REG_R_CURR_DEFAULT, buf); | ||
799 | ret = -EINVAL; | ||
800 | goto fail2; | ||
801 | } | ||
795 | usleep_range(10000, 20000); | 802 | usleep_range(10000, 20000); |
796 | 803 | ||
797 | ret = lp5521_detect(client); | 804 | ret = lp5521_detect(client); |