Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <daniel@zonque.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>

authored by

Daniel Mack and committed by
Pavel
b46d2b4d fc19967b

+4 -1
+4 -1
drivers/leds/leds-tlc591xx.c
··· 147 147 unsigned int i; 148 148 int err = 0; 149 149 150 - tlc591xx_set_mode(priv->regmap, MODE2_DIM); 150 + err = tlc591xx_set_mode(priv->regmap, MODE2_DIM); 151 + if (err < 0) 152 + return err; 153 + 151 154 for (i = 0; i < TLC591XX_MAX_LEDS; i++) { 152 155 struct tlc591xx_led *led = &priv->leds[i]; 153 156