]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amd/display: Fix incorrect pointer assignment
authorChaitanya Dhere <chaitanya.dhere@amd.com>
Thu, 4 Apr 2024 18:34:04 +0000 (14:34 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Apr 2024 01:24:38 +0000 (21:24 -0400)
[Why]
Pointer initialization and assignment for dml2_options is not done
correctly. While this works for some compilers, others give an error.

[How]
Modify dc_state_create code to correctly initialize the dml2_opt pointer
and pass it to dml2_create. Also update the code with correct derefrence
operations.

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Chaitanya Dhere <chaitanya.dhere@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_state.c

index bf889bdd3925b2d6bdea4f41a435d61d24642d0e..76bb05f4d6bf3d14c2d681f20a690857cc18e010 100644 (file)
@@ -191,7 +191,7 @@ static void init_state(struct dc *dc, struct dc_state *state)
 struct dc_state *dc_state_create(struct dc *dc, struct dc_state_create_params *params)
 {
 #ifdef CONFIG_DRM_AMD_DC_FP
-       struct dml2_configuration_options dml2_opt = dc->dml2_options;
+       struct dml2_configuration_options *dml2_opt = &dc->dml2_options;
 #endif
        struct dc_state *state = kvzalloc(sizeof(struct dc_state),
                        GFP_KERNEL);
@@ -205,11 +205,11 @@ struct dc_state *dc_state_create(struct dc *dc, struct dc_state_create_params *p
 
 #ifdef CONFIG_DRM_AMD_DC_FP
        if (dc->debug.using_dml2) {
-               dml2_opt.use_clock_dc_limits = false;
-               dml2_create(dc, &dml2_opt, &state->bw_ctx.dml2);
+               dml2_opt->use_clock_dc_limits = false;
+               dml2_create(dc, dml2_opt, &state->bw_ctx.dml2);
 
-               dml2_opt.use_clock_dc_limits = true;
-               dml2_create(dc, &dml2_opt, &state->bw_ctx.dml2_dc_power_source);
+               dml2_opt->use_clock_dc_limits = true;
+               dml2_create(dc, dml2_opt, &state->bw_ctx.dml2_dc_power_source);
        }
 #endif