public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] drm/nv50/pm: signedness bug in nv50_pm_clocks_pre()
@ 2012-01-04  7:20 Dan Carpenter
  2012-01-09 23:28 ` Martin Peres
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-01-04  7:20 UTC (permalink / raw)
  To: David Airlie
  Cc: kernel-janitors, Emil Velikov, Ben Skeggs, dri-devel,
	Martin Peres

calc_mclk() returns zero on success and negative on failure but clk is
a u32.

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

diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c
index 0393721..3508de9 100644
--- a/drivers/gpu/drm/nouveau/nv50_pm.c
+++ b/drivers/gpu/drm/nouveau/nv50_pm.c
@@ -540,7 +540,7 @@ nv50_pm_clocks_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl)
 	info->mclk_hwsq.len = 0;
 	if (perflvl->memory) {
 		clk = calc_mclk(dev, perflvl->memory, &info->mclk_hwsq);
-		if (clk < 0) {
+		if ((int)clk < 0) {
 			ret = clk;
 			goto error;
 		}

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

* Re: [patch] drm/nv50/pm: signedness bug in nv50_pm_clocks_pre()
  2012-01-04  7:20 [patch] drm/nv50/pm: signedness bug in nv50_pm_clocks_pre() Dan Carpenter
@ 2012-01-09 23:28 ` Martin Peres
  2012-01-10  5:39   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Peres @ 2012-01-09 23:28 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, Emil Velikov, Ben Skeggs, dri-devel

Le 04/01/2012 08:20, Dan Carpenter a écrit :
> calc_mclk() returns zero on success and negative on failure but clk is
> a u32.
>
> Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c
> index 0393721..3508de9 100644
> --- a/drivers/gpu/drm/nouveau/nv50_pm.c
> +++ b/drivers/gpu/drm/nouveau/nv50_pm.c
> @@ -540,7 +540,7 @@ nv50_pm_clocks_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl)
>   	info->mclk_hwsq.len = 0;
>   	if (perflvl->memory) {
>   		clk = calc_mclk(dev, perflvl->memory,&info->mclk_hwsq);
> -		if (clk<  0) {
> +		if ((int)clk<  0) {
>   			ret = clk;
>   			goto error;
>   		}
Well spotted Dan!

Sorry for the late answer, was busy reworking this file for safe reclocking.

I have a slightly different fix for that. Please tell me if It suits 
you: 
https://gitorious.org/linux-nouveau-pm/linux-nouveau-pm/commit/c1b80360ezd1aa7dd780ac383aae9437c66ef3b89
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch] drm/nv50/pm: signedness bug in nv50_pm_clocks_pre()
  2012-01-09 23:28 ` Martin Peres
@ 2012-01-10  5:39   ` Dan Carpenter
  2012-01-10  8:05     ` Martin Peres
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-01-10  5:39 UTC (permalink / raw)
  To: Martin Peres; +Cc: kernel-janitors, Emil Velikov, Ben Skeggs, dri-devel

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

On Tue, Jan 10, 2012 at 12:28:13AM +0100, Martin Peres wrote:
> Le 04/01/2012 08:20, Dan Carpenter a écrit :
> >calc_mclk() returns zero on success and negative on failure but clk is
> >a u32.
> >
> >Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>
> >
> >diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c
> >index 0393721..3508de9 100644
> >--- a/drivers/gpu/drm/nouveau/nv50_pm.c
> >+++ b/drivers/gpu/drm/nouveau/nv50_pm.c
> >@@ -540,7 +540,7 @@ nv50_pm_clocks_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl)
> >  	info->mclk_hwsq.len = 0;
> >  	if (perflvl->memory) {
> >  		clk = calc_mclk(dev, perflvl->memory,&info->mclk_hwsq);
> >-		if (clk<  0) {
> >+		if ((int)clk<  0) {
> >  			ret = clk;
> >  			goto error;
> >  		}
> Well spotted Dan!
> 
> Sorry for the late answer, was busy reworking this file for safe reclocking.
> 
> I have a slightly different fix for that. Please tell me if It suits
> you: https://gitorious.org/linux-nouveau-pm/linux-nouveau-pm/commit/c1b80360ezd1aa7dd780ac383aae9437c66ef3b89

That link redirects to
https://gitorious.org/linux-nouveau-pm/linux-nouveau-pm/commits/master
and it doesn't show the patch.

But I wasn't a huge fan of adding the cast very much either so I'm
sure your patch is good.

regards,
dan carpenter

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

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

* Re: [patch] drm/nv50/pm: signedness bug in nv50_pm_clocks_pre()
  2012-01-10  5:39   ` Dan Carpenter
@ 2012-01-10  8:05     ` Martin Peres
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Peres @ 2012-01-10  8:05 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, Emil Velikov, Ben Skeggs, dri-devel

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

Le 10/01/2012 06:39, Dan Carpenter a écrit :
> On Tue, Jan 10, 2012 at 12:28:13AM +0100, Martin Peres wrote:
>> Le 04/01/2012 08:20, Dan Carpenter a écrit :
>>> calc_mclk() returns zero on success and negative on failure but clk is
>>> a u32.
>>>
>>> Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>
>>>
>>> diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c
>>> index 0393721..3508de9 100644
>>> --- a/drivers/gpu/drm/nouveau/nv50_pm.c
>>> +++ b/drivers/gpu/drm/nouveau/nv50_pm.c
>>> @@ -540,7 +540,7 @@ nv50_pm_clocks_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl)
>>>   	info->mclk_hwsq.len = 0;
>>>   	if (perflvl->memory) {
>>>   		clk = calc_mclk(dev, perflvl->memory,&info->mclk_hwsq);
>>> -		if (clk<   0) {
>>> +		if ((int)clk<   0) {
>>>   			ret = clk;
>>>   			goto error;
>>>   		}
>> Well spotted Dan!
>>
>> Sorry for the late answer, was busy reworking this file for safe reclocking.
>>
>> I have a slightly different fix for that. Please tell me if It suits
>> you: https://gitorious.org/linux-nouveau-pm/linux-nouveau-pm/commit/c1b80360ezd1aa7dd780ac383aae9437c66ef3b89
> That link redirects to
> https://gitorious.org/linux-nouveau-pm/linux-nouveau-pm/commits/master
> and it doesn't show the patch.
>
> But I wasn't a huge fan of adding the cast very much either so I'm
> sure your patch is good.
>
> regards,
> dan carpenter
Sorry, here is the patch attached.

[-- Attachment #2: 0005-drm-nv50-pm-signedness-bug-in-nv50_pm_clocks_pre.patch --]
[-- Type: text/x-patch, Size: 1197 bytes --]

From c1b80360ed1aa7dd780ac383aae9437c66ef3b89 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 4 Jan 2012 10:20:47 +0300
Subject: [PATCH 5/7] drm/nv50/pm: signedness bug in nv50_pm_clocks_pre()

calc_mclk() returns zero on success and negative on failure but clk is
a u32.

v2: Martin Peres:
- clk should be an int, not a u32

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/nouveau/nv50_pm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_pm.c b/drivers/gpu/drm/nouveau/nv50_pm.c
index 983b432..4be2e20 100644
--- a/drivers/gpu/drm/nouveau/nv50_pm.c
+++ b/drivers/gpu/drm/nouveau/nv50_pm.c
@@ -659,11 +659,11 @@ nv50_pm_clocks_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl)
 	struct nv50_pm_state *info;
 	struct hwsq_ucode *hwsq;
 	struct pll_lims pll;
-	int ret = -EINVAL;
+	int clk, ret = -EINVAL;
 	int N, M, P1, P2;
 	u32 mast = nv_rd32(dev, 0x00c040);
 	u32 divs = read_div(dev);
-	u32 ctrl, clk, out;
+	u32 ctrl, out;
 
 	if (dev_priv->chipset == 0xaa ||
 	    dev_priv->chipset == 0xac)
-- 
1.7.8.1


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

end of thread, other threads:[~2012-01-10  8:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-04  7:20 [patch] drm/nv50/pm: signedness bug in nv50_pm_clocks_pre() Dan Carpenter
2012-01-09 23:28 ` Martin Peres
2012-01-10  5:39   ` Dan Carpenter
2012-01-10  8:05     ` Martin Peres

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