Commit 44c606b0 authored by Denis Osterland-Heim's avatar Denis Osterland-Heim Committed by Pavel Machek

leds: pwm: check result of led_pwm_set() in led_pwm_add()

led_pwm_set() now returns an error when setting the PWM fails.
Signed-off-by: default avatarDenis Osterland-Heim <Denis.Osterland@diehl.com>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent ba50e011
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment