]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drivers: leds: tlc591xx: check error during device init
authorDaniel Mack <daniel@zonque.org>
Fri, 13 Sep 2019 18:07:49 +0000 (20:07 +0200)
committerPavel <pavel@ucw.cz>
Sun, 3 Nov 2019 16:37:13 +0000 (17:37 +0100)
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 <daniel@zonque.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
drivers/leds/leds-tlc591xx.c

index 59ff088c7d75c5bf34dd2a6da818e93af6adeb49..00702824d27cd98e293345908049cfe43fb238b5 100644 (file)
@@ -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];