drm_atomic_helper_connector_hdmi_check() must only be used with connectors set up via drmm_connector_hdmi_init(), which guarantees connector->hdmi.funcs is set.
Other connectors used to fail gracefully: with max_bpc and supported_formats both zero, hdmi_compute_config() found no usable format/bpc combination and returned -EINVAL before hdmi_generate_infoframes() dereferenced hdmi.funcs. As those fields are being replaced by drm_connector_hdmi_funcs counterparts, hdmi_compute_config() would dereference hdmi.funcs right away. To preserve the old behaviour, return an error early for such connectors, and use drm_WARN_ON_ONCE() to flag the driver bug. Signed-off-by: Cristian Ciocaltea <[email protected]> --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c index c50cedc7fa65..f533d5a7aab9 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -912,6 +912,9 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector, if (!new_conn_state->crtc || !new_conn_state->best_encoder) return 0; + if (drm_WARN_ON_ONCE(connector->dev, !connector->hdmi.funcs)) + return -EINVAL; + ret = hdmi_compute_config(connector, new_conn_state, mode); if (ret) return ret; -- 2.56.0
