drivers: leds: tlc591xx: check error during device init
PATCH 1/1 drivers: leds: tlc591xx: check error during device init
The driver currently ignores errors from register writes at probe time. It will hence register an LED class device no matter whether the pyhsical device is present or not.
To fix this, make the device probe fail in case regmap operations return an error.
--- drivers/leds/leds-tlc591xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/leds/leds-tlc591xx.c +4 -1
@@ -147,7 +147,10 @@ tlc591xx_configure(struct device *dev,unsigned int i;int err =0 ; -tlc591xx_set_mode (priv->regmap,MODE2_DIM ); + err =tlc591xx_set_mode (priv->regmap,MODE2_DIM ); +if (err <0 ) +return err; +for (i =0 ; i <TLC591XX_MAX_LEDS ; i++) {struct tlc591xx_led *led = &priv->leds[i];
Signature · 1 line
2.21.0
Quoted 8 lines · Daniel Mack
The driver currently ignores errors from register writes at probe time. It will hence register an LED class device no matter whether the pyhsical device is present or not.
To fix this, make the device probe fail in case regmap operations return an error.
Signed-off-by Daniel Mack <[email protected]>
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Jacek Anaszewski
AppliedHi Daniel,
Thank you for the patch.
Quoted 19 lines · Daniel Mack
The driver currently ignores errors from register writes at probe time. It will hence register an LED class device no matter whether the pyhsical device is present or not.
To fix this, make the device probe fail in case regmap operations return an error.
Signed-off-by Daniel Mack <[email protected]>--- drivers/leds/leds-tlc591xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/leds/leds-tlc591xx.c +0
-0@@ -147,7 +147,10 @@ tlc591xx_configure(struct device *dev,unsigned int i;
drivers/leds/leds-tlc591xx.c tlc591xx_configure(struct device *dev, · line 156
Quoted 10 lines
drivers/leds/leds-tlc591xx.c +4
-1int err =0 ; -tlc591xx_set_mode (priv->regmap,MODE2_DIM ); + err =tlc591xx_set_mode (priv->regmap,MODE2_DIM ); +if (err <0 ) +return err; +for (i =0 ; i <TLC591XX_MAX_LEDS ; i++) {struct tlc591xx_led *led = &priv->leds[i];
Applied.
Signature · 2 lines
Best regards, Jacek Anaszewski