lkml.org 
[lkml]   [2020]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 3/5] leds: pwm: check result of led_pwm_set() in led_pwm_add()
Hi!

> led_pwm_set() now returns an error when setting the PWM fails.
>
> Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
> Signed-off-by: Denis Osterland-Heim <Denis.Osterland@diehl.com>

I applied 1 and 2, but 3 failed for me. I'll push updated -next, can
you see what is going on there?

Best regards,
Pavel

> +++ 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)

>
> The contents of the above mentioned e-mail is not legally
> binding. This e-mail contains confidential and/or legally protected
> information. Please inform us if you have received this e-mail by

This is lie. Please don't do this.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-03-21 16:21    [W:0.104 / U:2.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site