diff mbox

backlight: pm8941-wled: fix ptr_ret.cocci warnings

Message ID 20151026182611.GA14761@roam (mailing list archive)
State New, archived
Headers show

Commit Message

Fengguang Wu Oct. 26, 2015, 6:26 p.m. UTC
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 <bjorn.andersson@sonymobile.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

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

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Bjorn Andersson Oct. 26, 2015, 6:33 p.m. UTC | #1
On Mon, Oct 26, 2015 at 11:26 AM, kbuild test robot
<fengguang.wu@intel.com> wrote:
> 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

Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lee Jones Oct. 27, 2015, 8:39 a.m. UTC | #2
On Tue, 27 Oct 2015, kbuild test robot wrote:

> 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 <bjorn.andersson@sonymobile.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
>  pm8941-wled.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Applied, thanks.

> --- a/drivers/video/backlight/pm8941-wled.c
> +++ b/drivers/video/backlight/pm8941-wled.c
> @@ -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[] = {
diff mbox

Patch

--- a/drivers/video/backlight/pm8941-wled.c
+++ b/drivers/video/backlight/pm8941-wled.c
@@ -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[] = {