Skip to contentSkip to conversation

drm/tidss: Return drm_mode_status values from tidss_oldi_mode_valid()

PATCH New Ian Rogers 1 participant 1 message Nov 19

Subsystems (3)
lore
Share & tools
lore

Ian Rogers

author
#0 lore raw

PATCH 1/1 drm/tidss: Return drm_mode_status values from tidss_oldi_mode_valid()

tidss_oldi_mode_valid() has return type enum drm_mode_status, but returns -EINVAL (-22) when the rounded serial clock differs by more than 5% and 0 otherwise. When drm_mode_prune_invalid() logs rejected modes via drm_get_mode_status_name(), status == -22 computes a negative table index (-19) and triggers a WARN_ON().

Return MODE_CLOCK_RANGE and MODE_OK instead, matching dispc_vp_mode_valid().

Found via Clang -Wimplicit-int-enum-cast on an x86_64 allyesconfig build. Verified by building drivers/gpu/drm/tidss/tidss_oldi.o with LLVM=1 W=1 (-Werror) and -Wimplicit-int-enum-cast, and with a standalone C reproducer; not runtime-tested on TI DSS OLDI hardware.

Fixes 86db652fc22f ("drm/tidss: Move OLDI mode validation to OLDI bridge mode_valid hook")
---
 drivers/gpu/drm/tidss/tidss_oldi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_oldi.c +2 -2
index 62c9780f7855..3b5046628642 100644
@@ -322,9 +322,9 @@ tidss_oldi_mode_valid(struct drm_bridge *bridge,
 	 * we use the same 5% check here.
 	 */
 	if (dispc_pclk_diff(mode->clock * 7 * 1000, round_clock) > 5)
-		return -EINVAL;
+		return MODE_CLOCK_RANGE;
 
-	return 0;
+	return MODE_OK;
 }
 
 static const struct drm_bridge_funcs tidss_oldi_bridge_funcs = {
Signature · 1 line
2.56.1.708.g77570a6a1d-goog