summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorMartin Peres <martin.peres@labri.fr>2013-03-15 05:09:20 +0400
committerBen Skeggs <bskeggs@redhat.com>2013-03-18 05:15:27 +0400
commit76c0295c389ad9ba19b668b5974cdd90eb95788e (patch)
treed10c976b8bdf3b2f001216204f035afb3d39b376 /drivers/gpu/drm
parentad40d73ef533ab0ad16b4a1ab2f7870c1f8ab954 (diff)
downloadlinux-76c0295c389ad9ba19b668b5974cdd90eb95788e.tar.xz
drm/nv40/therm: reserve negative temperatures for errors
Signed-off-by: Martin Peres <martin.peres@labri.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c b/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c
index c526d536409f..a70d1b7e397b 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c
@@ -102,6 +102,10 @@ nv40_temp_get(struct nouveau_therm *therm)
core_temp = core_temp + sensor->offset_num / sensor->offset_den;
core_temp = core_temp + sensor->offset_constant - 8;
+ /* reserve negative temperatures for errors */
+ if (core_temp < 0)
+ core_temp = 0;
+
return core_temp;
}