diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2013-01-27 14:51:09 (GMT) |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2013-02-20 06:00:36 (GMT) |
commit | fc3109a2cb294335bcf3c5db5e16ae5fe68849f2 (patch) | |
tree | 0f0b7c5f6fa71cf8242d66f874b98bf6d8c1b44b /drivers/gpu | |
parent | cd897837eacc6ce0b883b5e6c9000cb2e5f11c39 (diff) | |
download | linux-fsl-qoriq-fc3109a2cb294335bcf3c5db5e16ae5fe68849f2.tar.xz |
drm/nouveau/fan: fix selection of fan speed when fan->get returns an error
fan->get returns int, but we write it to unsigned variable, and then check
whether it's >= 0 (it always is)
Found by smatch:
drivers/gpu/drm/nouveau/core/subdev/therm/fan.c:61 nouveau_fan_update() warn: always true condition '(duty >= 0) => (0-u32max >= 0)'
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/therm/fan.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c index b179655..c728380 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c +++ b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c @@ -39,7 +39,7 @@ nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target) struct nouveau_timer *ptimer = nouveau_timer(priv); unsigned long flags; int ret = 0; - u32 duty; + int duty; /* update target fan speed, restricting to allowed range */ spin_lock_irqsave(&fan->lock, flags); @@ -64,9 +64,9 @@ nouveau_fan_update(struct nouveau_fan *fan, bool immediate, int target) * it is meant to bump the fan speed more incrementally */ if (duty < target) - duty = min(duty + 3, (u32) target); + duty = min(duty + 3, target); else if (duty > target) - duty = max(duty - 3, (u32) target); + duty = max(duty - 3, target); } else { duty = target; } |