From: Mario Limonciello <mario.limoncie...@amd.com>

Using a _free(kfree) macro drops the need for a goto statement
as it will be freed when it goes out of scope.

Reviewed-by: Alex Hung <alex.h...@amd.com>
Signed-off-by: Mario Limonciello <mario.limoncie...@amd.com>
Signed-off-by: Wayne Lin <wayne....@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 892c4d5baa50..153a073f93de 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3298,14 +3298,14 @@ static void dm_gpureset_commit_state(struct dc_state 
*dc_state,
                struct dc_scaling_info scaling_infos[MAX_SURFACES];
                struct dc_flip_addrs flip_addrs[MAX_SURFACES];
                struct dc_stream_update stream_update;
-       } *bundle;
+       } *bundle __free(kfree);
        int k, m;
 
        bundle = kzalloc(sizeof(*bundle), GFP_KERNEL);
 
        if (!bundle) {
                drm_err(dm->ddev, "Failed to allocate update bundle\n");
-               goto cleanup;
+               return;
        }
 
        for (k = 0; k < dc_state->stream_count; k++) {
@@ -3325,9 +3325,6 @@ static void dm_gpureset_commit_state(struct dc_state 
*dc_state,
                                         &bundle->stream_update,
                                         bundle->surface_updates);
        }
-
-cleanup:
-       kfree(bundle);
 }
 
 static int dm_resume(struct amdgpu_ip_block *ip_block)
-- 
2.37.3

Reply via email to