<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Patch #2 has a typo should be 'j' in the loop. </p>
<p><br>
</p>
<p>I'll resend that patch in a second.</p>
<p><br>
</p>
<p>Tom</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Tom St Denis <tstdenis82@gmail.com><br>
<b>Sent:</b> Thursday, August 25, 2016 13:10<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> StDenis, Tom<br>
<b>Subject:</b> [PATCH 2/3] drm/amd/amdgpu: Clean up memory leak in cz_dpm_init().</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">If init fails free up any allocated memory.<br>
<br>
Signed-off-by: Tom St Denis <tom.stdenis@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/cz_dpm.c | 14 +++++++++-----<br>
1 file changed, 9 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c<br>
index b06b95ce1350..d97604386766 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c<br>
@@ -44,6 +44,7 @@<br>
<br>
static void cz_dpm_powergate_uvd(struct amdgpu_device *adev, bool gate);<br>
static void cz_dpm_powergate_vce(struct amdgpu_device *adev, bool gate);<br>
+static void cz_dpm_fini(struct amdgpu_device *adev);<br>
<br>
static struct cz_ps *cz_get_ps(struct amdgpu_ps *rps)<br>
{<br>
@@ -411,11 +412,11 @@ static int cz_dpm_init(struct amdgpu_device *adev)<br>
<br>
ret = amdgpu_get_platform_caps(adev);<br>
if (ret)<br>
- return ret;<br>
+ goto err;<br>
<br>
ret = amdgpu_parse_extended_power_table(adev);<br>
if (ret)<br>
- return ret;<br>
+ goto err;<br>
<br>
pi->sram_end = SMC_RAM_END;<br>
<br>
@@ -469,23 +470,26 @@ static int cz_dpm_init(struct amdgpu_device *adev)<br>
<br>
ret = cz_parse_sys_info_table(adev);<br>
if (ret)<br>
- return ret;<br>
+ goto err;<br>
<br>
cz_patch_voltage_values(adev);<br>
cz_construct_boot_state(adev);<br>
<br>
ret = cz_parse_power_table(adev);<br>
if (ret)<br>
- return ret;<br>
+ goto err;<br>
<br>
ret = cz_process_firmware_header(adev);<br>
if (ret)<br>
- return ret;<br>
+ goto err;<br>
<br>
pi->dpm_enabled = true;<br>
pi->uvd_dynamic_pg = false;<br>
<br>
return 0;<br>
+err:<br>
+ cz_dpm_fini(adev);<br>
+ return ret;<br>
}<br>
<br>
static void cz_dpm_fini(struct amdgpu_device *adev)<br>
-- <br>
2.9.2<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>