drm/radeon/dpm/r6xx: properly catch errors in dpm setup
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Mar 2013 23:18:46 +0000 (19:18 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jun 2013 23:16:51 +0000 (19:16 -0400)
We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/rv6xx_dpm.c

index 2beb3d7cf77a8c4a1703343d52ed48f49ead5198..120a63261c1a8c7b18214e46f34213475355845c 100644 (file)
@@ -1511,6 +1511,7 @@ int rv6xx_dpm_enable(struct radeon_device *rdev)
 {
        struct rv6xx_power_info *pi = rv6xx_get_pi(rdev);
        struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps;
+       int ret;
 
        if (r600_dynamicpm_enabled(rdev))
                return -EINVAL;
@@ -1560,7 +1561,9 @@ int rv6xx_dpm_enable(struct radeon_device *rdev)
 
        if (rdev->irq.installed &&
            r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) {
-               r600_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
+               ret = r600_set_thermal_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX);
+               if (ret)
+                       return ret;
                rdev->irq.dpm_thermal = true;
                radeon_irq_set(rdev);
        }
@@ -1630,6 +1633,7 @@ int rv6xx_dpm_set_power_state(struct radeon_device *rdev)
        struct rv6xx_power_info *pi = rv6xx_get_pi(rdev);
        struct radeon_ps *new_ps = rdev->pm.dpm.requested_ps;
        struct radeon_ps *old_ps = rdev->pm.dpm.current_ps;
+       int ret;
 
        rv6xx_clear_vc(rdev);
        r600_power_level_enable(rdev, R600_POWER_LEVEL_LOW, true);
@@ -1684,8 +1688,11 @@ int rv6xx_dpm_set_power_state(struct radeon_device *rdev)
        r600_power_level_enable(rdev, R600_POWER_LEVEL_MEDIUM, false);
 
        if (pi->voltage_control) {
-               if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_STEPVDDC)
-                       rv6xx_step_voltage_if_decreasing(rdev, new_ps, old_ps);
+               if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_STEPVDDC) {
+                       ret = rv6xx_step_voltage_if_decreasing(rdev, new_ps, old_ps);
+                       if (ret)
+                               return ret;
+               }
                rv6xx_enable_dynamic_voltage_control(rdev, true);
        }