Skip to contentSkip to conversation

drm/amd/display: Add a default case for dc_status_to_str

PATCH In review [email protected] 3 participants 3 messages May 27

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

PATCH 1/1 drm/amd/display: Add a default case for dc_status_to_str

From: Ivan Lipski <[email protected]>

[Why&How]
If a parsed dc_status case is not covered by the dc_status_to_str, the switch case is skipped, and the function returns "Unexpected status error".

This causes build failures when new dc_status enums are introduced. Changing the 'return "Unexpected status error"' into default resolves it.

---
 drivers/gpu/drm/amd/display/dc/core/dc_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_debug.c +2 -2
index bbce751b485f..44028ba88f80 100644
@@ -272,9 +272,9 @@ char *dc_status_to_str(enum dc_status status)
 		return "Fail DP Tunnel BW validation";
 	case DC_ERROR_UNEXPECTED:
 		return "Unexpected error";
+	default:
+		return "Unexpected status error";
 	}
-
-	return "Unexpected status error";
 }
 
 char *dc_pixel_encoding_to_str(enum dc_pixel_encoding pixel_encoding)
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Wed, May 27, 2026 at 3:43 PM <[email protected]> wrote:

From: Ivan Lipski <[email protected]>

[Why&How]
If a parsed dc_status case is not covered by the dc_status_to_str, the switch case is skipped, and the function returns "Unexpected status error".

Quoted 4 lines

This causes build failures when new dc_status enums are introduced. Changing the 'return "Unexpected status error"' into default resolves it.

Quoted 23 lines
---
 drivers/gpu/drm/amd/display/dc/core/dc_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_debug.c +2 -3
index bbce751b485f..44028ba88f80 100644
@@ -272,9 +272,9 @@ char *dc_status_to_str(enum dc_status status)
                return "Fail DP Tunnel BW validation";
        case DC_ERROR_UNEXPECTED:
                return "Unexpected error";
+       default:
+               return "Unexpected status error";
        }
-
-       return "Unexpected status error";
 }
 
 char *dc_pixel_encoding_to_str(enum dc_pixel_encoding pixel_encoding)
--

2.43.0

Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 31 lines · On 5/27/26 13:41, [email protected] wrote:

From: Ivan Lipski <[email protected]>

[Why&How]
If a parsed dc_status case is not covered by the dc_status_to_str, the switch case is skipped, and the function returns "Unexpected status error".

This causes build failures when new dc_status enums are introduced. Changing the 'return "Unexpected status error"' into default resolves it.

---
  drivers/gpu/drm/amd/display/dc/core/dc_debug.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_debug.c +2 -2
index bbce751b485f..44028ba88f80 100644
@@ -272,9 +272,9 @@ char *dc_status_to_str(enum dc_status status)
  		return "Fail DP Tunnel BW validation";
  	case DC_ERROR_UNEXPECTED:
  		return "Unexpected error";
+	default:
+		return "Unexpected status error";
  	}
-
-	return "Unexpected status error";
  }
 
  char *dc_pixel_encoding_to_str(enum dc_pixel_encoding pixel_encoding)