summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-03-22 15:38:15 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-06-27 19:16:38 -0400
commitf907eec036511ed2ff8cc5de58b6a1cef4bb4033 (patch)
tree96fcf7e387dcb64176ef11d257a1d5ffeb89c919 /drivers/gpu
parentb253e4b359ee1bf25299a31337b7d95b21ab9cd9 (diff)
drm/radeon: fix some memory leaks in extended table parsing
Forgot to free some structs when allocation fails for some tables. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/r600_dpm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
index 37917497209..2e5ec65a78f 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -878,8 +878,12 @@ int r600_parse_extended_power_table(struct radeon_device *rdev)
kzalloc(psl->ucNumEntries *
sizeof(struct radeon_phase_shedding_limits_entry),
GFP_KERNEL);
- if (!rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries)
+ if (!rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) {
+ kfree(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries);
+ kfree(rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk.entries);
+ kfree(rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk.entries);
return -ENOMEM;
+ }
for (i = 0; i < psl->ucNumEntries; i++) {
rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries[i].sclk =
@@ -946,8 +950,13 @@ int r600_parse_extended_power_table(struct radeon_device *rdev)
le16_to_cpu(ext_hdr->usPPMTableOffset));
rdev->pm.dpm.dyn_state.ppm_table =
kzalloc(sizeof(struct radeon_ppm_table), GFP_KERNEL);
- if (!rdev->pm.dpm.dyn_state.ppm_table)
+ if (!rdev->pm.dpm.dyn_state.ppm_table) {
+ kfree(rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries);
+ kfree(rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk.entries);
+ kfree(rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk.entries);
+ kfree(rdev->pm.dpm.dyn_state.cac_leakage_table.entries);
return -ENOMEM;
+ }
rdev->pm.dpm.dyn_state.ppm_table->ppm_design = ppm->ucPpmDesign;
rdev->pm.dpm.dyn_state.ppm_table->cpu_core_number =
le16_to_cpu(ppm->usCpuCoreNumber);