drm/nouveau/therm: disable auto fan management if temperature is not available
authorMartin Peres <martin.peres@labri.fr>
Thu, 14 Mar 2013 23:21:07 +0000 (00:21 +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/base.c

index 3f8083f41be8cee36dcb7dbada45037882ae13b7..d6a05589c9418b08cc01e401fe1a80a7a1257e66 100644 (file)
@@ -149,6 +149,11 @@ nouveau_therm_fan_mode(struct nouveau_therm *therm, int mode)
            (mode != NOUVEAU_THERM_CTRL_NONE && device->card_type >= NV_C0))
                return -EINVAL;
 
+       /* do not allow automatic fan management if the thermal sensor is
+        * not available */
+       if (priv->mode == 2 && therm->temp_get(therm) < 0)
+               return -EINVAL;
+
        if (priv->mode == mode)
                return 0;