drm/tegra: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO

Submitted by Duan Jiong on Nov. 6, 2013, 7:53 a.m.

Details

Message ID 1383724435-15380-1-git-send-email-duanj.fnst@cn.fujitsu.com
State Not Applicable
Headers show

Commit Message

Duan Jiong Nov. 6, 2013, 7:53 a.m.
This patch fixes coccinelle error regarding usage of IS_ERR and
PTR_ERR instead of PTR_ERR_OR_ZERO.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 drivers/gpu/drm/tegra/gem.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Stephen Warren Nov. 6, 2013, 4:49 p.m.
On 11/06/2013 12:53 AM, Duan Jiong wrote:
> This patch fixes coccinelle error regarding usage of IS_ERR and
> PTR_ERR instead of PTR_ERR_OR_ZERO.

> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c

> @@ -199,10 +199,7 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
>  
>  	bo = tegra_bo_create_with_handle(file, drm, args->size, 0,
>  					 &args->handle);
> -	if (IS_ERR(bo))
> -		return PTR_ERR(bo);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(bo);
>  }

I suppose that's fine, although I wonder if it'll cause churn should we
ever need to add code to the tail end of the function.

BTW, why were all the similar patches that had nothing to do with Tegra
sent to the linux-tegra@ mailing list? You also didn't CC the
maintainers of drivers/gpu/drm/tegra/ on this patch. Plus this patch has
nothing to do with the rtc-linux@ mailing list.
Duan Jiong Nov. 7, 2013, 1:15 a.m.
于 2013年11月07日 00:49, Stephen Warren 写道:
> On 11/06/2013 12:53 AM, Duan Jiong wrote:
>> This patch fixes coccinelle error regarding usage of IS_ERR and
>> PTR_ERR instead of PTR_ERR_OR_ZERO.
> 
>> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> 
>> @@ -199,10 +199,7 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
>>  
>>  	bo = tegra_bo_create_with_handle(file, drm, args->size, 0,
>>  					 &args->handle);
>> -	if (IS_ERR(bo))
>> -		return PTR_ERR(bo);
>> -
>> -	return 0;
>> +	return PTR_ERR_OR_ZERO(bo);
>>  }
> 
> I suppose that's fine, although I wonder if it'll cause churn should we
> ever need to add code to the tail end of the function.
> 
> BTW, why were all the similar patches that had nothing to do with Tegra
> sent to the linux-tegra@ mailing list? You also didn't CC the
> maintainers of drivers/gpu/drm/tegra/ on this patch. Plus this patch has
> nothing to do with the rtc-linux@ mailing list.

I'm sorry for that. i just get the maintainers and the mail lists by the script
get_maintainer.pl.

> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
Thierry Reding Nov. 11, 2013, 6:23 a.m.
On Wed, Nov 06, 2013 at 05:49:55PM +0100, Stephen Warren wrote:
> On 11/06/2013 12:53 AM, Duan Jiong wrote:
> > This patch fixes coccinelle error regarding usage of IS_ERR and
> > PTR_ERR instead of PTR_ERR_OR_ZERO.
> 
> > diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> 
> > @@ -199,10 +199,7 @@ int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
> >  
> >  	bo = tegra_bo_create_with_handle(file, drm, args->size, 0,
> >  					 &args->handle);
> > -	if (IS_ERR(bo))
> > -		return PTR_ERR(bo);
> > -
> > -	return 0;
> > +	return PTR_ERR_OR_ZERO(bo);
> >  }
> 
> I suppose that's fine, although I wonder if it'll cause churn should we
> ever need to add code to the tail end of the function.

It's unlikely that we'll ever need to add to this function. But I'm not
a big fan of PTR_ERR_OR_ZERO to be honest, so I'll let this sink in for
a bit before applying.

Thierry

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index 28a9cbc..ba6a7ac 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -199,10 +199,7 @@  int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
 
 	bo = tegra_bo_create_with_handle(file, drm, args->size, 0,
 					 &args->handle);
-	if (IS_ERR(bo))
-		return PTR_ERR(bo);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(bo);
 }
 
 int tegra_bo_dumb_map_offset(struct drm_file *file, struct drm_device *drm,