summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorMartin Peres <martin.peres@labri.fr>2013-03-15 01:09:20 (GMT)
committerBen Skeggs <bskeggs@redhat.com>2013-03-18 01:15:27 (GMT)
commit76c0295c389ad9ba19b668b5974cdd90eb95788e (patch)
treed10c976b8bdf3b2f001216204f035afb3d39b376 /drivers/gpu/drm
parentad40d73ef533ab0ad16b4a1ab2f7870c1f8ab954 (diff)
downloadlinux-fsl-qoriq-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 c526d53..a70d1b7 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;
}