Skip to contentSkip to conversation

leds/leds-pwm: Display error code on request_pwm failure

PATCH In review Ben Gamari 2 participants 4 messages Dec 17, 2013 LED

lore
Share & tools
lore

Ben Gamari

author
#0 lore raw

PATCH 1/1 leds/leds-pwm: Display error code on request_pwm failure

This can be useful in debugging devicetrees.

---
 drivers/leds/leds-pwm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/leds-pwm.c +2 -2
index b31d8e9..707a82a 100644
@@ -165,8 +165,8 @@ static int led_pwm_probe(struct platform_device *pdev)
 			if (IS_ERR(led_dat->pwm)) {
 				ret = PTR_ERR(led_dat->pwm);
 				dev_err(&pdev->dev,
-					"unable to request PWM for %s\n",
-					cur_led->name);
+					"unable to request PWM for %s: error=%d\n",
+					cur_led->name, ret);
 				goto err;
 			}
 
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 2 lines · Ben Gamari

This can be useful in debugging devicetrees.

OK, I will merge this.

Thanks,
-Bryan

Quoted 23 lines
---
 drivers/leds/leds-pwm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/leds-pwm.c +2 -3
index b31d8e9..707a82a 100644
@@ -165,8 +165,8 @@ static int led_pwm_probe(struct platform_device *pdev)
                        if (IS_ERR(led_dat->pwm)) {
                                ret = PTR_ERR(led_dat->pwm);
                                dev_err(&pdev->dev,
-                                       "unable to request PWM for %s\n",
-                                       cur_led->name);
+                                       "unable to request PWM for %s: error=%d\n",
+                                       cur_led->name, ret);
                                goto err;
                        }
 
--

1.8.3.2

#2 lore raw
Quoted 16 lines · Bryan Wu
Quoted 2 lines · Ben Gamari

This can be useful in debugging devicetrees.

OK, I will merge this.

Thanks,
-Bryan

Quoted 5 lines
---
 drivers/leds/leds-pwm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 11 lines

drivers/leds/leds-pwm.c static int led_pwm_probe(struct platform_device *pdev) · line 168

Quoted 11 lines
drivers/leds/leds-pwm.c +1 -2
index b31d8e9..707a82a 100644
@@ -165,8 +165,8 @@ static int led_pwm_probe(struct platform_device *pdev)
                        if (IS_ERR(led_dat->pwm)) {
                                ret = PTR_ERR(led_dat->pwm);
                                dev_err(&pdev->dev,
-                                       "unable to request PWM for %s\n",
-                                       cur_led->name);
+                                       "unable to request PWM for %s: error=%d\n",

Oh, hold on, this line has more than 80 characters. Please fix this coding style error.

-Bryan

Quoted 7 lines
Quoted 7 lines
drivers/leds/leds-pwm.c +1 -1
+                                       cur_led->name, ret);
                                goto err;
                        }
 
--

1.8.3.2

author
#3 lore raw
Quoted 17 lines · Bryan Wu
Quoted 16 lines · Bryan Wu
Quoted 2 lines · Ben Gamari

This can be useful in debugging devicetrees.

OK, I will merge this.

Thanks,
-Bryan

Quoted 5 lines
---
 drivers/leds/leds-pwm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 15 lines
Quoted 11 lines

drivers/leds/leds-pwm.c static int led_pwm_probe(struct platform_device *pdev) · line 168

Quoted 11 lines
drivers/leds/leds-pwm.c +1 -2
index b31d8e9..707a82a 100644
@@ -165,8 +165,8 @@ static int led_pwm_probe(struct platform_device *pdev)
                        if (IS_ERR(led_dat->pwm)) {
                                ret = PTR_ERR(led_dat->pwm);
                                dev_err(&pdev->dev,
-                                       "unable to request PWM for %s\n",
-                                       cur_led->name);
+                                       "unable to request PWM for %s: error=%d\n",

Oh, hold on, this line has more than 80 characters. Please fix this coding style error.

Would this not fall under the "unless" clause of the kernel style guidelines,

Statements longer than 80 columns will be broken into sensible chunks, unless exceeding 80 columns significantly increases readability and does not hide information.

The line is 82 characters long by my count and there is no reasonable way to break it. The only fix I can think of here is to introduce a local variable for the format string but in my opinion this is far less readable than what we currently have. Which would you prefer?

Cheers,

- Ben