drm/nv40/therm: reserve negative temperatures for errors
authorMartin Peres <martin.peres@labri.fr>
Fri, 15 Mar 2013 01:09:20 +0000 (02:09 +0100)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 18 Mar 2013 01:15:27 +0000 (11:15 +1000)
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c

index c526d536409faa957b9d7b7f7eed9cf9124d71b4..a70d1b7e397b4b3ffe280b1f0ad6152679f6f15b 100644 (file)
@@ -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;
 }