Skip to contentSkip to conversation

drivers/video/backlight/pm8941-wled.c:404:1-3: WARNING: PTR_ERR_OR_ZERO can be used

DISCUSSION Applied kbuild test robot 3 participants 4 messages Oct 26, 2015 – Oct 27, 2015

Subsystems (3)
lore
Share & tools
lore

kbuild test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   85051e295fb7487fd22546f86058e99d5266dd88
commit: 7ddbc2423c3301280b883bbb04b998203f30312c backlight: pm8941-wled: Move PM8941 WLED driver to backlight
date:   9 weeks ago

coccinelle warnings: (new ones prefixed by >>)

>> drivers/video/backlight/pm8941-wled.c:404:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

author build bot
#1 lore raw

[PATCH] backlight: pm8941-wled: fix ptr_ret.cocci warnings

drivers/video/backlight/pm8941-wled.c:404:1-3: WARNING: PTR_ERR_OR_ZERO can be used

drivers/video/backlight/pm8941-wled.c:404:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

CC Bjorn Andersson <[email protected]>

---

 pm8941-wled.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/video/backlight/pm8941-wled.c +1 -4
@@ -401,10 +401,7 @@ static int pm8941_wled_probe(struct plat
 	bl = devm_backlight_device_register(&pdev->dev, wled->name,
 					    &pdev->dev, wled,
 					    &pm8941_wled_ops, &props);
-	if (IS_ERR(bl))
-		return PTR_ERR(bl);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(bl);
 };
 
 static const struct of_device_id pm8941_wled_match_table[] = {
#2 lore raw

Re: [PATCH] backlight: pm8941-wled: fix ptr_ret.cocci warnings

Quoted 7 lines · kbuild test robot

drivers/video/backlight/pm8941-wled.c:404:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Cool, I didn't know that. Thanks

Quoted 1 line

Regards,
Bjorn

Applied
#3 lore raw

Re: [PATCH] backlight: pm8941-wled: fix ptr_ret.cocci warnings

In reply to kbuild test robot
Quoted 5 lines · kbuild test robot

drivers/video/backlight/pm8941-wled.c:404:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Quoted 8 lines

Generated by: scripts/coccinelle/api/ptr_ret.cocci

CC Bjorn Andersson <[email protected]>

---

 pm8941-wled.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Applied, thanks.

Quoted 14 lines
drivers/video/backlight/pm8941-wled.c +1 -4
@@ -401,10 +401,7 @@ static int pm8941_wled_probe(struct plat
 	bl = devm_backlight_device_register(&pdev->dev, wled->name,
 					    &pdev->dev, wled,
 					    &pm8941_wled_ops, &props);
-	if (IS_ERR(bl))
-		return PTR_ERR(bl);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(bl);
 };
 
 static const struct of_device_id pm8941_wled_match_table[] = {
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog