From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Tue, 11 Oct 2011 14:34:53 +0000 Subject: [patch] drm/nva3: checking the wrong variable Message-Id: <20111011143453.GA29096@elgon.mountain> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: David Airlie Cc: kernel-janitors@vger.kernel.org, Ben Skeggs , dri-devel@lists.freedesktop.org "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 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); From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [patch] drm/nva3: checking the wrong variable Date: Tue, 11 Oct 2011 17:34:53 +0300 Message-ID: <20111011143453.GA29096@elgon.mountain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by gabe.freedesktop.org (Postfix) with ESMTP id A1F9E9E9E2 for ; Tue, 11 Oct 2011 07:35:11 -0700 (PDT) Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: David Airlie Cc: kernel-janitors@vger.kernel.org, Ben Skeggs , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org "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 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);