Skip to contentSkip to conversation

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

PATCH In review Alex Deucher 3 participants 3 messages Mar 14, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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

---
 drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c +4 -2
index 15e1afa28018..219950882be9 100644
@@ -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;
 }
 
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180314014613.14695-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#2 lore raw

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

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

---
 drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c +1 -2
index 15e1afa28018..219950882be9 100644
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): DM5PR1201MB248901BA08487897F5F1A3FBE4D10-grEf7a3NxMAAZHT/xKzwlGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

Reviewed-by Reviewed-by Evan Quan
#4 lore raw

Best Regards

Rex

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

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

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

---
 drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c +1 -2
index 15e1afa28018..219950882be9 100644
@@ -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
[email protected]
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
[email protected]
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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx