]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm: renesas: shmobile: remove now-redundant call to drm_connector_attach_encoder()
authorLuca Ceresoli <luca.ceresoli@bootlin.com>
Thu, 23 Apr 2026 11:55:50 +0000 (13:55 +0200)
committerLuca Ceresoli <luca.ceresoli@bootlin.com>
Thu, 30 Apr 2026 09:15:46 +0000 (11:15 +0200)
shmob_drm_connector_create() can init the connector in two ways, based on
the 'if (sdev->pdata)':

 1. manually in shmob_drm_connector_create(), or
 2. delegating to drm_bridge_connector_init()

Whichever branch is taken, drm_connector_attach_encoder() is called
immediately after to attach the connector to the encoder.

Now drm_bridge_connector_init() calls drm_connector_attach_encoder() on the
connector so it is not needed anymore in case 2 and should be removed, but
it is still needed in case 1. Move drm_connector_attach_encoder() from the
common path to inside shmob_drm_connector_create() in order to get back to
a single drm_connector_attach_encoder() in both cases.

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20260423115550.444930-7-luca.ceresoli@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c

index 5f460b38596ce0ead1fe5fb2a7287161a397b4ed..815c770147ed67eaa53ce990e8321268ed864fe1 100644 (file)
@@ -583,6 +583,13 @@ shmob_drm_connector_init(struct shmob_drm_device *sdev,
 
        drm_connector_helper_add(connector, &connector_helper_funcs);
 
+       ret = drm_connector_attach_encoder(connector, encoder);
+       if (ret < 0) {
+               drm_connector_cleanup(connector);
+               kfree(scon);
+               return ERR_PTR(ret);
+       }
+
        return connector;
 }
 
@@ -594,7 +601,6 @@ int shmob_drm_connector_create(struct shmob_drm_device *sdev,
                               struct drm_encoder *encoder)
 {
        struct drm_connector *connector;
-       int ret;
 
        if (sdev->pdata)
                connector = shmob_drm_connector_init(sdev, encoder);
@@ -606,17 +612,9 @@ int shmob_drm_connector_create(struct shmob_drm_device *sdev,
                return PTR_ERR(connector);
        }
 
-       ret = drm_connector_attach_encoder(connector, encoder);
-       if (ret < 0)
-               goto error;
-
        connector->dpms = DRM_MODE_DPMS_OFF;
 
        sdev->connector = connector;
 
        return 0;
-
-error:
-       drm_connector_cleanup(connector);
-       return ret;
 }