Re: [PATCH v4] leds: pwm: check result of led_pwm_set() in led_pwm_add()

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

 



Hi Denis,

Now it is better, it is:
Content-Transfer-Encoding: quoted-printable.

Nonetheless there are still some problems with charset.
See e.g. the line:

"if (ret =3D=3D 0) "

Are you using git send-email for sending patches?
I suspect not since patches arrive unordered by the
position in the patch set.

Best regards,
Jacek Anaszewski


On 3/23/20 10:14 AM, Denis Osterland-Heim wrote:
> led_pwm_set() now returns an error when setting the PWM fails.
> 
> Signed-off-by: Denis Osterland-Heim <Denis.Osterland@xxxxxxxxx>
> ---
>  drivers/leds/leds-pwm.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
> index 6caf8bea8cd5..07eab2d8b7c7 100644
> --- a/drivers/leds/leds-pwm.c
> +++ b/drivers/leds/leds-pwm.c
> @@ -91,15 +91,21 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
>  	pwm_init_state(led_data->pwm, &led_data->pwmstate);
>  
>  	ret = devm_led_classdev_register(dev, &led_data->cdev);
> -	if (ret == 0) {
> -		priv->num_leds++;
> -		led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
> -	} else {
> +	if (ret) {
>  		dev_err(dev, "failed to register PWM led for %s: %d\n",
>  			led->name, ret);
> +		return ret;
>  	}
>  
> -	return ret;
> +	ret = led_pwm_set(&led_data->cdev, led_data->cdev.brightness);
> +	if (ret) {
> +		dev_err(dev, "failed to set led PWM value for %s: %d",
> +			led->name, ret);
> +		return ret;
> +	}
> +
> +	priv->num_leds++;
> +	return 0;
>  }
>  
>  static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv)
> 




[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