* [PATCH v2] leds: an30259a: add a check for devm_regmap_init_i2c
@ 2019-10-16 12:54 Chuhong Yuan
2019-10-16 14:33 ` Dan Murphy
2019-11-04 9:09 ` Pavel Machek
0 siblings, 2 replies; 3+ messages in thread
From: Chuhong Yuan @ 2019-10-16 12:54 UTC (permalink / raw)
Cc: Jacek Anaszewski, Pavel Machek, Dan Murphy, linux-leds,
linux-kernel, Chuhong Yuan
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;
+ }
+
for (i = 0; i < chip->num_leds; i++) {
struct led_init_data init_data = {};
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] leds: an30259a: add a check for devm_regmap_init_i2c
2019-10-16 12:54 [PATCH v2] leds: an30259a: add a check for devm_regmap_init_i2c Chuhong Yuan
@ 2019-10-16 14:33 ` Dan Murphy
2019-11-04 9:09 ` Pavel Machek
1 sibling, 0 replies; 3+ messages in thread
From: Dan Murphy @ 2019-10-16 14:33 UTC (permalink / raw)
To: Chuhong Yuan; +Cc: Jacek Anaszewski, Pavel Machek, linux-leds, linux-kernel
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 = {};
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] leds: an30259a: add a check for devm_regmap_init_i2c
2019-10-16 12:54 [PATCH v2] leds: an30259a: add a check for devm_regmap_init_i2c Chuhong Yuan
2019-10-16 14:33 ` Dan Murphy
@ 2019-11-04 9:09 ` Pavel Machek
1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2019-11-04 9:09 UTC (permalink / raw)
To: Chuhong Yuan; +Cc: Jacek Anaszewski, Dan Murphy, linux-leds, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 433 bytes --]
On Wed 2019-10-16 20:54:03, 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>
Thanks, applied.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-04 9:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 12:54 [PATCH v2] leds: an30259a: add a check for devm_regmap_init_i2c Chuhong Yuan
2019-10-16 14:33 ` Dan Murphy
2019-11-04 9:09 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).