]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/amd/display: Use _free(kfree) for dm_gpureset_commit_state()
authorMario Limonciello <mario.limonciello@amd.com>
Tue, 18 Feb 2025 04:58:36 +0000 (22:58 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 5 Mar 2025 15:42:08 +0000 (10:42 -0500)
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.hung@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 900ac463078ccb2440ecf3d43a0ded279dd4bcce..4ad9178228d4cd34a1d8cbce5695a816e6362ea1 100644 (file)
@@ -3301,14 +3301,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++) {
@@ -3328,9 +3328,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)