kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] drm/tegra: checking IS_ERR() instead of NULL
@ 2014-12-04 11:00 Dan Carpenter
  2014-12-04 13:23 ` Thierry Reding
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2014-12-04 11:00 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Terje Bergström, David Airlie, Stephen Warren,
	Alexandre Courbot, dri-devel, linux-tegra, kernel-janitors

iommu_domain_alloc() returns NULL on error, it never returns error
pointers.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index e549afe..fa16048 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
 
 	if (iommu_present(&platform_bus_type)) {
 		tegra->domain = iommu_domain_alloc(&platform_bus_type);
-		if (IS_ERR(tegra->domain)) {
-			err = PTR_ERR(tegra->domain);
+		if (!tegra->domain) {
+			err = -ENOMEM;
 			goto free;
 		}
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] drm/tegra: checking IS_ERR() instead of NULL
  2014-12-04 11:00 [patch] drm/tegra: checking IS_ERR() instead of NULL Dan Carpenter
@ 2014-12-04 13:23 ` Thierry Reding
       [not found]   ` <20141204132349.GD7262-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2014-12-04 13:23 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Terje Bergström, David Airlie, Stephen Warren,
	Alexandre Courbot, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

On Thu, Dec 04, 2014 at 02:00:35PM +0300, Dan Carpenter wrote:
> iommu_domain_alloc() returns NULL on error, it never returns error
> pointers.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index e549afe..fa16048 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
>  
>  	if (iommu_present(&platform_bus_type)) {
>  		tegra->domain = iommu_domain_alloc(&platform_bus_type);
> -		if (IS_ERR(tegra->domain)) {
> -			err = PTR_ERR(tegra->domain);
> +		if (!tegra->domain) {
> +			err = -ENOMEM;
>  			goto free;
>  		}

Oh, good catch. Applied, thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] drm/tegra: checking IS_ERR() instead of NULL
       [not found]   ` <20141204132349.GD7262-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
@ 2014-12-05 12:07     ` SF Markus Elfring
       [not found]       ` <54819FFF.4000907-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: SF Markus Elfring @ 2014-12-05 12:07 UTC (permalink / raw)
  To: Thierry Reding, Dan Carpenter
  Cc: Terje Bergström, David Airlie, Stephen Warren,
	Alexandre Courbot, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

>> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
>> index e549afe..fa16048 100644
>> --- a/drivers/gpu/drm/tegra/drm.c
>> +++ b/drivers/gpu/drm/tegra/drm.c
>> @@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
>>  
>>  	if (iommu_present(&platform_bus_type)) {
>>  		tegra->domain = iommu_domain_alloc(&platform_bus_type);
>> -		if (IS_ERR(tegra->domain)) {
>> -			err = PTR_ERR(tegra->domain);
>> +		if (!tegra->domain) {
>> +			err = -ENOMEM;
>>  			goto free;
>>  		}
> 
> Oh, good catch. Applied, thanks.

How do you think about to amend the commit title?

Is the following wording more appropriate?
drm/tegra: Checking for NULL pointer instead of IS_ERR() usage

Regards,
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] drm/tegra: checking IS_ERR() instead of NULL
       [not found]       ` <54819FFF.4000907-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
@ 2014-12-05 13:19         ` Thierry Reding
  0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2014-12-05 13:19 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: Dan Carpenter, Terje Bergström, David Airlie,
	Stephen Warren, Alexandre Courbot,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 968 bytes --]

On Fri, Dec 05, 2014 at 01:07:27PM +0100, SF Markus Elfring wrote:
> >> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> >> index e549afe..fa16048 100644
> >> --- a/drivers/gpu/drm/tegra/drm.c
> >> +++ b/drivers/gpu/drm/tegra/drm.c
> >> @@ -36,8 +36,8 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
> >>  
> >>  	if (iommu_present(&platform_bus_type)) {
> >>  		tegra->domain = iommu_domain_alloc(&platform_bus_type);
> >> -		if (IS_ERR(tegra->domain)) {
> >> -			err = PTR_ERR(tegra->domain);
> >> +		if (!tegra->domain) {
> >> +			err = -ENOMEM;
> >>  			goto free;
> >>  		}
> > 
> > Oh, good catch. Applied, thanks.
> 
> How do you think about to amend the commit title?
> 
> Is the following wording more appropriate?
> drm/tegra: Checking for NULL pointer instead of IS_ERR() usage

Sounds better yes. I've gone with:

	drm/tegra: Check for NULL pointer instead of IS_ERR()

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-05 13:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-04 11:00 [patch] drm/tegra: checking IS_ERR() instead of NULL Dan Carpenter
2014-12-04 13:23 ` Thierry Reding
     [not found]   ` <20141204132349.GD7262-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2014-12-05 12:07     ` SF Markus Elfring
     [not found]       ` <54819FFF.4000907-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
2014-12-05 13:19         ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).