Skip to contentSkip to conversation

leds: leds-pwm: return proper error if pwm_request failed

PATCH In review Axel Lin 2 participants 2 messages Jan 20, 2011 LED

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 leds: leds-pwm: return proper error if pwm_request failed

Return PTR_ERR(led_dat->pwm) instead of 0 if pwm_request failed

---
 drivers/leds/leds-pwm.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/leds/leds-pwm.c +1 -0
index da3fa8d..666daf7 100644
@@ -69,6 +69,7 @@ static int led_pwm_probe(struct platform_device *pdev)
 		led_dat->pwm = pwm_request(cur_led->pwm_id,
 				cur_led->name);
 		if (IS_ERR(led_dat->pwm)) {
+			ret = PTR_ERR(led_dat->pwm);
 			dev_err(&pdev->dev, "unable to request PWM %d\n",
 					cur_led->pwm_id);
 			goto err;
Signature · 1 line
1.7.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Axel Lin

Return PTR_ERR(led_dat->pwm) instead of 0 if pwm_request failed

Looks good.

Quoted 16 lines
---
 drivers/leds/leds-pwm.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/leds/leds-pwm.c +1 -0
index da3fa8d..666daf7 100644
@@ -69,6 +69,7 @@ static int led_pwm_probe(struct platform_device *pdev)
 		led_dat->pwm = pwm_request(cur_led->pwm_id,
 				cur_led->name);
 		if (IS_ERR(led_dat->pwm)) {
+			ret = PTR_ERR(led_dat->pwm);
 			dev_err(&pdev->dev, "unable to request PWM %d\n",
 					cur_led->pwm_id);
 			goto err;
Signature · 1 line
Dmitry