From: Daniel Mack Date: Fri, 13 Sep 2019 18:07:49 +0000 (+0200) Subject: drivers: leds: tlc591xx: check error during device init X-Git-Tag: v5.5-rc1~98^2~23 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=b46d2b4d3d8166ab51f491a2801e2cbed2e8a7aa;p=linux.git 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. Signed-off-by: Daniel Mack Signed-off-by: Pavel Machek --- diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c index 59ff088c7d75..00702824d27c 100644 --- a/drivers/leds/leds-tlc591xx.c +++ b/drivers/leds/leds-tlc591xx.c @@ -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];