[patch] drm/nv50/pm: signedness bug in nv50_pm_clocks_pre()

Dan Carpenter dan.carpenter at oracle.com
Mon Jan 9 21:39:19 PST 2012


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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20120110/e24aecef/attachment.pgp>


More information about the dri-devel mailing list