On Thu, Mar 12, 2026 at 10:19 AM Srinivasan Shanmugam <[email protected]> wrote: > > amdgpu_connector_dvi_mode_valid() assigns max_digital_pixel_clock_khz > from a switch on connector_object_id, but the switch has no default > case. > > Simply initializing the variable would silence the warning, but it would > also hide an unexpected connector_object_id and continue mode validation > with an arbitrary fallback limit. That makes the code less explicit and > can mask invalid hardware or BIOS data.
I think this fix is effectively dead code. The existing cases should cover all possible digital connector types that this function would be used for so we'd never hit that case. I suppose if this function ever got used for some other connector types it might be a problem, but there would be other things missing as well, plus this is legacy code so it won't be used on any new hardware. If you update the commit message along those lines and note that it's good practice to have a default case, but it shouldn't ever be hit here, the patch is: Acked-by: Alex Deucher <[email protected]> Alex > > Handle this by rejecting unknown digital connector IDs with MODE_BAD. > This keeps the behavior explicit, avoids using an uninitialized value, > and preserves the intended validation logic for known connector types. > > Fixes the below: > drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c:1243 > amdgpu_connector_dvi_mode_valid() error: uninitialized symbol > 'max_digital_pixel_clock_khz'. > > Fixes: 585b2f685c56 ("drm/amdgpu: Respect max pixel clock for HDMI and DVI-D > (v2)") > Cc: Dan Carpenter <[email protected]> > Cc: Timur Kristóf <[email protected]> > Cc: Alex Deucher <[email protected]> > Cc: Christian König <[email protected]> > Signed-off-by: Srinivasan Shanmugam <[email protected]> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > index 04842e3f1ccc..a8ccc1602eb5 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c > @@ -1231,6 +1231,8 @@ static enum drm_mode_status > amdgpu_connector_dvi_mode_valid(struct drm_connector > case CONNECTOR_OBJECT_ID_HDMI_TYPE_B: > max_digital_pixel_clock_khz = > max_dvi_single_link_pixel_clock * 2; > break; > + default: > + return MODE_BAD; > } > > /* When the display EDID claims that it's an HDMI display, > -- > 2.34.1 >
