mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
leds: an30259a: add a check for devm_regmap_init_i2c
[ Upstream commit fc7b5028f2
]
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>
This commit is contained in:
parent
af4eac2a28
commit
fd2f1bc5b6
1 changed files with 7 additions and 0 deletions
|
@ -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 = {};
|
||||
|
||||
|
|
Loading…
Reference in a new issue