[PATCH] drm/amdgpu/powerplay/vega10: fix memory leak in error path

Zhu, Rex Rex.Zhu at amd.com
Wed Mar 14 08:07:13 UTC 2018


Reviewed-by: Rex Zhu <Rex.Zhu at amd.com>


Best Regards

Rex

________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Quan, Evan <Evan.Quan at amd.com>
Sent: Wednesday, March 14, 2018 11:20 AM
To: Alex Deucher; amd-gfx at lists.freedesktop.org
Cc: Deucher, Alexander
Subject: RE: [PATCH] drm/amdgpu/powerplay/vega10: fix memory leak in error path

Reviewed-by: Evan Quan <evan.quan at amd.com>

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf Of Alex Deucher
Sent: Wednesday, March 14, 2018 9:46 AM
To: amd-gfx at lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
Subject: [PATCH] drm/amdgpu/powerplay/vega10: fix memory leak in error path

Free the backend structure if we fail to allocate device memory.

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c
index 15e1afa28018..219950882be9 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c
@@ -406,9 +406,8 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr)
                         &handle,
                         &mc_addr,
                         &kaddr);
-
         if (ret)
-               return -EINVAL;
+               goto free_backend;

         priv->smu_tables.entry[PPTABLE].version = 0x01;
         priv->smu_tables.entry[PPTABLE].size = sizeof(PPTable_t); @@ -511,6 +510,9 @@ static int vega10_smu_init(struct pp_hwmgr *hwmgr)
         amdgpu_bo_free_kernel(&priv->smu_tables.entry[PPTABLE].handle,
                         &priv->smu_tables.entry[PPTABLE].mc_addr,
                         &priv->smu_tables.entry[PPTABLE].table);
+free_backend:
+       kfree(hwmgr->smu_backend);
+
         return -EINVAL;
 }

--
2.13.6

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all freedesktop.org lists is subject to our Code of ...


_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
Subscribing to amd-gfx: Subscribe to amd-gfx by filling out the following form. Use of all freedesktop.org lists is subject to our Code of ...


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20180314/9b9d56a2/attachment.html>


More information about the amd-gfx mailing list