Browse Source

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>
Martin Peres 12 years ago
parent
commit
76c0295c38
1 changed files with 4 additions and 0 deletions
  1. 4 0
      drivers/gpu/drm/nouveau/core/subdev/therm/nv40.c

+ 4 - 0
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;
 }