public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] drm/nva3: checking the wrong variable
@ 2011-10-11 14:34 Dan Carpenter
  2011-10-11 22:26 ` Ben Skeggs
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-10-11 14:34 UTC (permalink / raw)
  To: David Airlie; +Cc: kernel-janitors, Ben Skeggs, dri-devel

"id" is unsigned here and it's never less than zero.  I believe the
intent was to check the return value from nva3_pm_pll_offset().
Also I've changed it to pass on the -ENOENT error code from the lower
levels instead of returning -EINVAL.

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

diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
index e4b2b9e..0be517d 100644
--- a/drivers/gpu/drm/nouveau/nva3_pm.c
+++ b/drivers/gpu/drm/nouveau/nva3_pm.c
@@ -112,8 +112,8 @@ nva3_pm_clock_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl,
 		return (ret = -ENOENT) ? NULL : ERR_PTR(ret);
 
 	off = nva3_pm_pll_offset(id);
-	if (id < 0)
-		return ERR_PTR(-EINVAL);
+	if (off < 0)
+		return ERR_PTR(off);
 
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);

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

* Re: [patch] drm/nva3: checking the wrong variable
  2011-10-11 14:34 [patch] drm/nva3: checking the wrong variable Dan Carpenter
@ 2011-10-11 22:26 ` Ben Skeggs
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Skeggs @ 2011-10-11 22:26 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, dri-devel

On Tue, 2011-10-11 at 17:34 +0300, Dan Carpenter wrote:
> "id" is unsigned here and it's never less than zero.  I believe the
> intent was to check the return value from nva3_pm_pll_offset().
> Also I've changed it to pass on the -ENOENT error code from the lower
> levels instead of returning -EINVAL.
The patch looks correct.  It's worth noting though that a complete
rewrite of that particular code is queued for 3.2 already.

Ben.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/gpu/drm/nouveau/nva3_pm.c b/drivers/gpu/drm/nouveau/nva3_pm.c
> index e4b2b9e..0be517d 100644
> --- a/drivers/gpu/drm/nouveau/nva3_pm.c
> +++ b/drivers/gpu/drm/nouveau/nva3_pm.c
> @@ -112,8 +112,8 @@ nva3_pm_clock_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl,
>  		return (ret = -ENOENT) ? NULL : ERR_PTR(ret);
>  
>  	off = nva3_pm_pll_offset(id);
> -	if (id < 0)
> -		return ERR_PTR(-EINVAL);
> +	if (off < 0)
> +		return ERR_PTR(off);
>  
> 
>  	pll = kzalloc(sizeof(*pll), GFP_KERNEL);



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

end of thread, other threads:[~2011-10-11 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-11 14:34 [patch] drm/nva3: checking the wrong variable Dan Carpenter
2011-10-11 22:26 ` Ben Skeggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox