summaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorChuhong Yuan <hslester96@gmail.com>2019-10-16 20:54:03 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-04 19:17:03 +0100
commitfd2f1bc5b673328f3b14ecd1da8d7389c862bea9 (patch)
treec46e582084683e6dfe40a48e44ada2d260a45ddc /drivers/leds
parentaf4eac2a2871a97f6284f816930ab612bbd6c01c (diff)
leds: an30259a: add a check for devm_regmap_init_i2c
[ Upstream commit fc7b5028f2627133c7c18734715a08829eab4d1f ] an30259a_probe misses a check for devm_regmap_init_i2c and may cause problems. Add a check and print errors like other leds drivers. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-an30259a.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c
index 250dc9d6f635..82350a28a564 100644
--- a/drivers/leds/leds-an30259a.c
+++ b/drivers/leds/leds-an30259a.c
@@ -305,6 +305,13 @@ static int an30259a_probe(struct i2c_client *client)
chip->regmap = devm_regmap_init_i2c(client, &an30259a_regmap_config);
+ if (IS_ERR(chip->regmap)) {
+ err = PTR_ERR(chip->regmap);
+ dev_err(&client->dev, "Failed to allocate register map: %d\n",
+ err);
+ goto exit;
+ }
+
for (i = 0; i < chip->num_leds; i++) {
struct led_init_data init_data = {};