From: Chenyu Chen <[email protected]>

[Why]
In amdgpu_dm_set_panel_type() the DID fallback branch tested and wrote
link->panel_type, while the rest of the function tracked the result in
the local variable panel_type. The final assignment unconditionally
overwrites link->panel_type from panel_type, so the value derived from
DID was always discarded, making the DID branch dead code.

[How]
Use the local panel_type variable in the DID fallback branch so that the
DID result participates in the source priority (VSDB -> DPCD -> DID ->
vendor luminance heuristic -> LCD default) and is preserved by the final
assignment.

Assisted-by: Copilot:Claude-Opus-4.8
Reviewed-by: Alex Hung <[email protected]>
Signed-off-by: Chenyu Chen <[email protected]>
Signed-off-by: George Zhang <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
index b9a3c8aa611e..9d0231016ad6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
@@ -420,11 +420,11 @@ static void amdgpu_dm_set_panel_type(struct 
amdgpu_dm_connector *aconnector)
        }

        /* If VSDB and DPCD didn't determine panel type, check DID */
-       if (link->panel_type == PANEL_TYPE_NONE) {
+       if (panel_type == PANEL_TYPE_NONE) {
                if (display_info->panel_type == DRM_MODE_PANEL_TYPE_LCD)
-                       link->panel_type = PANEL_TYPE_LCD;
+                       panel_type = PANEL_TYPE_LCD;
                else if (display_info->panel_type == DRM_MODE_PANEL_TYPE_OLED)
-                       link->panel_type = PANEL_TYPE_OLED;
+                       panel_type = PANEL_TYPE_OLED;
        }

        if (panel_type == PANEL_TYPE_NONE) {
--
2.55.0

Reply via email to