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 | 12 +++++++++++-
 1 file changed, 11 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..2d49fa92b8e2 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2606,5 +2606,15 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi)
         * 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)) {
+                       drm_connector_cleanup(connector);
+                       return PTR_ERR(conn_state);
+               }
+
+               connector->state = conn_state;
+       }
 
        drm_connector_attach_max_bpc_property(connector, 8, 16);

-- 
2.55.0

Reply via email to