The dw-hdmi driver calls drm_atomic_helper_connector_reset() during connector creation to allocate an initial connector state needed by drm_connector_attach_max_bpc_property(). However, the driver only needs to allocate a pristine state, which is exactly what atomic_create_state provides.
Convert to drm_atomic_helper_connector_create_state() with proper error handling. Signed-off-by: Maxime Ripard <[email protected]> --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 917cf764c9c5..5f11707c67b5 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2603,11 +2603,19 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) /* * drm_connector_attach_max_bpc_property() requires the * connector to have a state. */ - drm_atomic_helper_connector_reset(connector); + if (!connector->state) { + struct drm_connector_state *conn_state; + + conn_state = drm_atomic_helper_connector_create_state(connector); + if (IS_ERR(conn_state)) + return PTR_ERR(conn_state); + + connector->state = conn_state; + } drm_connector_attach_max_bpc_property(connector, 8, 16); if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) drm_connector_attach_hdr_output_metadata_property(connector); -- 2.55.0
