Re: [PATCH] drivers: leds: tlc591xx: check error during device init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Daniel,

Thank you for the patch.

On 9/13/19 8:07 PM, Daniel Mack wrote:
> 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@xxxxxxxxxx>
> ---
>  drivers/leds/leds-tlc591xx.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> 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];
>  
> 

Applied.

-- 
Best regards,
Jacek Anaszewski



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux