From: Luca Ceresoli Date: Thu, 23 Apr 2026 11:55:50 +0000 (+0200) Subject: drm: renesas: shmobile: remove now-redundant call to drm_connector_attach_encoder() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6533278b0deb14de860035dd1913e1e55e781e60;p=thirdparty%2Fkernel%2Flinux.git drm: renesas: shmobile: remove now-redundant call to drm_connector_attach_encoder() 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 Reviewed-by: Dmitry Baryshkov Link: https://patch.msgid.link/20260423115550.444930-7-luca.ceresoli@bootlin.com Signed-off-by: Luca Ceresoli --- diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c index 5f460b38596ce..815c770147ed6 100644 --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_crtc.c @@ -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; }