From: Dan Murphy <dmurphy@ti.com>
To: Chuhong Yuan <hslester96@gmail.com>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Pavel Machek <pavel@ucw.cz>, <linux-leds@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] leds: an30259a: add a check for devm_regmap_init_i2c
Date: Wed, 16 Oct 2019 09:33:53 -0500 [thread overview]
Message-ID: <1f4282aa-edb2-2683-bfff-8805a972710b@ti.com> (raw)
In-Reply-To: <20191016125403.23359-1-hslester96@gmail.com>
Chuhong
On 10/16/19 7:54 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@gmail.com>
> ---
> Changes in v2:
> - Use goto exit instead of return to destroy the mutex when failed.
>
> 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..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;
> + }
> +
Reviewed-by: Dan Murphy <dmurphy@ti.com>
> for (i = 0; i < chip->num_leds; i++) {
> struct led_init_data init_data = {};
>
next prev parent reply other threads:[~2019-10-16 14:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-16 12:54 Chuhong Yuan
2019-10-16 14:33 ` Dan Murphy [this message]
2019-11-04 9:09 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1f4282aa-edb2-2683-bfff-8805a972710b@ti.com \
--to=dmurphy@ti.com \
--cc=hslester96@gmail.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®