[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <89fb4769-d941-38d3-5536-fe4e750845b7@ti.com>
Date: Wed, 16 Oct 2019 07:29:37 -0500
From: Dan Murphy <dmurphy@...com>
To: Chuhong Yuan <hslester96@...il.com>
CC: Jacek Anaszewski <jacek.anaszewski@...il.com>,
Pavel Machek <pavel@....cz>, <linux-leds@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] leds: an30259a: add a check for devm_regmap_init_i2c
Chuhong
On 10/16/19 7:06 AM, Chuhong Yuan wrote:
> 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@...il.com>
> ---
> drivers/leds/leds-an30259a.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c
> index 250dc9d6f635..03ad068f29f7 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);
> + return err;
This should goto exit as the mutex is created before this allocation on
ln 302
Dan
Powered by blists - more mailing lists