Skip to contentSkip to conversation

Remove redundant checks on existence of 'bridge->encoder'

PATCH Applied Sui Jingfeng 2 participants 14 messages May 13, 2024

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover Remove redundant checks on existence of 'bridge->encoder'

The checks on the existence of bridge->encoder in the implementation of drm_bridge_funcs::attach() is not necessary, as it has already been checked in the drm_bridge_attach() function call by previous bridge or KMS driver. The drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons, hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when various bridge attach functions are called.

V1 -> V2:
* Gather all similar patches to form a series (Laurent)
* Fix various spell error (Laurent)
* Correct commit message for bridges of i.MX (Ying)

Sui Jingfeng (12):
drm/bridge: simple-bridge: Remove a redundant check on existence of

    bridge->encoder
  drm/bridge: tfp410: Remove a redundant check on existence of
    bridge->encoder
  drm/bridge: nxp-ptn3460: Remove a redundant check on existence of
    bridge->encoder
  drm/bridge: panel: Remove a redundant check on existence of
    bridge->encoder
  drm/bridge: it6505: Remove a redundant check on existence of
    bridge->encoder
  drm/bridge: adv7511: Remove a redundant check on existence of
    bridge->encoder
  drm/bridge: cdns-mhdp8546: Remove a redundant check on existence of
    bridge->encoder
  drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: Remove a redundant check
    on existence of bridge->encoder
  drm/bridge: synopsys: dw-mipi-dsi: Remove a redundant check on
    existence of bridge->encoder
  drm/bridge: lt9611uxc: Remove a redundant check on existence of
    bridge->encoder
  drm/bridge: imx: Remove redundant checks on existence of
    bridge->encoder
  drm/bridge: analogix: Remove redundant checks on existence of
    bridge->encoder
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c           |  5 -----
 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c     |  5 -----
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c     |  5 -----
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c     |  5 -----
 drivers/gpu/drm/bridge/analogix/anx7625.c              | 10 ----------
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c    |  5 -----
 drivers/gpu/drm/bridge/imx/imx-ldb-helper.c            |  5 -----
 drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c    |  5 -----
 drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c        |  5 -----
 drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c           |  5 -----
 drivers/gpu/drm/bridge/ite-it6505.c                    |  5 -----
 drivers/gpu/drm/bridge/lontium-lt9611uxc.c             |  5 -----
 .../gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c   |  5 -----
 drivers/gpu/drm/bridge/nxp-ptn3460.c                   |  5 -----
 drivers/gpu/drm/bridge/panel.c                         |  5 -----
 drivers/gpu/drm/bridge/simple-bridge.c                 |  5 -----
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c          |  5 -----
 drivers/gpu/drm/bridge/ti-tfp410.c                     |  5 -----
 18 files changed, 95 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/12 drm/bridge: simple-bridge: Remove a redundant check on existence of bridge->encoder

Because the existence of 'bridge->encoder' has already been checked before the simple_bridge_attach() function get called, and drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons. Hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when the simple_bridge_attach() get called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/simple-bridge.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/simple-bridge.c +0 -5
index 5813a2c4fc5e..2ca89f313cd1 100644
@@ -116,11 +116,6 @@ static int simple_bridge_attach(struct drm_bridge *bridge,
 	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
 		return 0;
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Missing encoder\n");
-		return -ENODEV;
-	}
-
 	drm_connector_helper_add(&sbridge->connector,
 				 &simple_bridge_con_helper_funcs);
 	ret = drm_connector_init_with_ddc(bridge->dev, &sbridge->connector,
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/12 drm/bridge: tfp410: Remove a redundant check on existence of bridge->encoder

In reply to Sui Jingfeng

Because the existence of bridge->encoder has already been checked before the simple_bridge_attach() function get called, And drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons. Hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when the tfp410_attach() function get called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/ti-tfp410.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/ti-tfp410.c +0 -5
index c7bef5c23927..b1b1e4d5a24a 100644
@@ -133,11 +133,6 @@ static int tfp410_attach(struct drm_bridge *bridge,
 	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
 		return 0;
 
-	if (!bridge->encoder) {
-		dev_err(dvi->dev, "Missing encoder\n");
-		return -ENODEV;
-	}
-
 	if (dvi->next_bridge->ops & DRM_BRIDGE_OP_DETECT)
 		dvi->connector.polled = DRM_CONNECTOR_POLL_HPD;
 	else
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 3/12 drm/bridge: nxp-ptn3460: Remove a redundant check on existence of bridge->encoder

In reply to Sui Jingfeng

Because the existence of 'bridge->encoder' has already been checked before the ptn3460_bridge_attach() function get called, and drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons. Hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when the ptn3460_bridge_attach() function get called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/nxp-ptn3460.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/nxp-ptn3460.c +0 -5
index ed93fd4c3265..e77aab965fcf 100644
@@ -229,11 +229,6 @@ static int ptn3460_bridge_attach(struct drm_bridge *bridge,
 	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
 		return 0;
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD;
 	ret = drm_connector_init(bridge->dev, &ptn_bridge->connector,
 			&ptn3460_connector_funcs, DRM_MODE_CONNECTOR_LVDS);
Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 4/12 drm/bridge: panel: Remove a redundant check on existence of bridge->encoder

In reply to Sui Jingfeng

Because the existence of 'bridge->encoder' has already been checked before the panel_bridge_attach() function get called, and the drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons. Hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when panel_bridge_attach() function get called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/panel.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/panel.c +0 -5
index 32506524d9a2..56c40b516a8f 100644
@@ -67,11 +67,6 @@ static int panel_bridge_attach(struct drm_bridge *bridge,
 	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
 		return 0;
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Missing encoder\n");
-		return -ENODEV;
-	}
-
 	drm_connector_helper_add(connector,
 				 &panel_bridge_connector_helper_funcs);
 
Signature · 1 line
2.43.0
#5 lore raw

PATCH v2 5/12 drm/bridge: it6505: Remove a redundant check on existence of bridge->encoder

In reply to Sui Jingfeng

In it6505_bridge_attach(), the check on the existence of 'bridge->encoder' is not necessary, as it has already been checked in the drm_bridge_attach() which happens prior to it6505_bridge_attach() get called. Note that the it6505_bridge_attach() will only be called by .attach() of the previous bridge or KMS driver. The previous drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons. Hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when it6505_bridge_attach() function get called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/ite-it6505.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +0 -5
index 3f68c82888c2..469157341f3a 100644
@@ -2882,11 +2882,6 @@ static int it6505_bridge_attach(struct drm_bridge *bridge,
 		return -EINVAL;
 	}
 
-	if (!bridge->encoder) {
-		dev_err(dev, "Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	/* Register aux channel */
 	it6505->aux.drm_dev = bridge->dev;
 
Signature · 1 line
2.43.0
#6 lore raw

PATCH v2 6/12 drm/bridge: adv7511: Remove a redundant check on existence of bridge->encoder

In reply to Sui Jingfeng

In the adv7511_connector_init() function, the check on the existence of bridge->encoder is not necessary. As it has already been checked in the drm_bridge_attach() which happens prior to the adv7511_bridge_attach() get called. Also note that the adv7511_connector_init() is only called by adv7511_bridge_attach(). Hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when adv7511_connector_init() get called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +0 -5
index dd21b81bd28f..6089b0bb9321 100644
@@ -877,11 +877,6 @@ static int adv7511_connector_init(struct adv7511 *adv)
 	struct drm_bridge *bridge = &adv->bridge;
 	int ret;
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	if (adv->i2c_main->irq)
 		adv->connector.polled = DRM_CONNECTOR_POLL_HPD;
 	else
Signature · 1 line
2.43.0
#7 lore raw

PATCH v2 7/12 drm/bridge: cdns-mhdp8546: Remove a redundant check on existence of bridge->encoder

In reply to Sui Jingfeng

In the cdns_mhdp_connector_init() function, the check on the existence of bridge->encoder is not necessary, as it has already been checked in the drm_bridge_attach() function. As the cdns_mhdp_connector_init() is only called by cdns_mhdp_attach(), it is guaranteed that the .encoder member of the struct drm_bridge is not NULL when cdns_mhdp_attach() gets called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +0 -5
index 8a91ef0ae065..dee640ab1d3a 100644
@@ -1697,11 +1697,6 @@ static int cdns_mhdp_connector_init(struct cdns_mhdp_device *mhdp)
 	struct drm_bridge *bridge = &mhdp->bridge;
 	int ret;
 
-	if (!bridge->encoder) {
-		dev_err(mhdp->dev, "Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	conn->polled = DRM_CONNECTOR_POLL_HPD;
 
 	ret = drm_connector_init(bridge->dev, conn, &cdns_mhdp_conn_funcs,
Signature · 1 line
2.43.0
#8 lore raw

PATCH v2 8/12 drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: Remove a redundant check on existence of bridge->encoder

In reply to Sui Jingfeng

In the ge_b850v3_lvds_create_connector function, the check on the existence of bridge->encoder is not necessary, as it has already been checked in the drm_bridge_attach() function called by upstream bridge or driver. Hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when cdns_mhdp_connector_init() function get called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +0 -5
index 4480523244e4..37f1acf5c0f8 100644
@@ -165,11 +165,6 @@ static int ge_b850v3_lvds_create_connector(struct drm_bridge *bridge)
 	struct drm_connector *connector = &ge_b850v3_lvds_ptr->connector;
 	int ret;
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	connector->polled = DRM_CONNECTOR_POLL_HPD;
 
 	drm_connector_helper_add(connector,
Signature · 1 line
2.43.0
#9 lore raw

PATCH v2 9/12 drm/bridge: synopsys: dw-mipi-dsi: Remove a redundant check on existence of bridge->encoder

In reply to Sui Jingfeng

In the dw_mipi_dsi_bridge_attach() function, the check on the existence of bridge->encoder is not necessary, as it has already been checked in the drm_bridge_attach() function invocked by previous bridge or KMS driver. The previous drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons, hence, it is guaranteed that the .encoder member of the struct drm_bridge is not NULL when dw_mipi_dsi_bridge_attach() function gets called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +0 -5
index 824fb3c65742..c4e9d96933dc 100644
@@ -1071,11 +1071,6 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge,
 {
 	struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge);
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Parent encoder object not found\n");
-		return -ENODEV;
-	}
-
 	/* Set the encoder type as caller does not know it */
 	bridge->encoder->encoder_type = DRM_MODE_ENCODER_DSI;
 
Signature · 1 line
2.43.0
#10 lore raw

PATCH v2 10/12 drm/bridge: lt9611uxc: Remove a redundant check on existence of bridge->encoder

In reply to Sui Jingfeng

In the lt9611uxc_connector_init() function, the check on the existence of bridge->encoder is not necessary, as it has already been checked in the drm_bridge_attach() function. And the check on the drm bridge core happens before check in the implementation. Hence, it is guaranteed that the .encoder member of the struct drm_bridge is not NULL when lt9611uxc_connector_init() function get called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/bridge/lontium-lt9611uxc.c +0 -5
index ab702471f3ab..f864c033ba81 100644
@@ -337,11 +337,6 @@ static int lt9611uxc_connector_init(struct drm_bridge *bridge, struct lt9611uxc
 {
 	int ret;
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	lt9611uxc->connector.polled = DRM_CONNECTOR_POLL_HPD;
 
 	drm_connector_helper_add(&lt9611uxc->connector,
Signature · 1 line
2.43.0
#11 lore raw

PATCH v2 11/12 drm/bridge: imx: Remove redundant checks on existence of bridge->encoder

In reply to Sui Jingfeng

The checks on the existence of bridge->encoder in the implementation of drm_bridge_funcs::attach() is not necessary, as it has already been checked in the drm_bridge_attach() function call by previous bridge or KMS driver. The drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons, hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when various i.MX specific bridge attach functions are called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/imx/imx-ldb-helper.c         | 5 -----
 drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 5 -----
 drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c     | 5 -----
 drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c        | 5 -----
 4 files changed, 20 deletions(-)
drivers/gpu/drm/bridge/imx/imx-ldb-helper.c +0 -5
index 6967325cd8ee..9b5bebbe357d 100644
@@ -116,11 +116,6 @@ int ldb_bridge_attach_helper(struct drm_bridge *bridge,
 		return -EINVAL;
 	}
 
-	if (!bridge->encoder) {
-		DRM_DEV_ERROR(ldb->dev, "missing encoder\n");
-		return -ENODEV;
-	}
-
 	return drm_bridge_attach(bridge->encoder,
 				ldb_ch->next_bridge, bridge,
 				DRM_BRIDGE_ATTACH_NO_CONNECTOR);
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +0 -5
index d0868a6ac6c9..e6dbbdc87ce2 100644
@@ -119,11 +119,6 @@ static int imx8qxp_pc_bridge_attach(struct drm_bridge *bridge,
 		return -EINVAL;
 	}
 
-	if (!bridge->encoder) {
-		DRM_DEV_ERROR(pc->dev, "missing encoder\n");
-		return -ENODEV;
-	}
-
 	return drm_bridge_attach(bridge->encoder,
 				 ch->next_bridge, bridge,
 				 DRM_BRIDGE_ATTACH_NO_CONNECTOR);
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c +0 -5
index ed8b7a4e0e11..1d11cc1df43c 100644
@@ -138,11 +138,6 @@ static int imx8qxp_pixel_link_bridge_attach(struct drm_bridge *bridge,
 		return -EINVAL;
 	}
 
-	if (!bridge->encoder) {
-		DRM_DEV_ERROR(pl->dev, "missing encoder\n");
-		return -ENODEV;
-	}
-
 	return drm_bridge_attach(bridge->encoder,
 				 pl->next_bridge, bridge,
 				 DRM_BRIDGE_ATTACH_NO_CONNECTOR);
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c +0 -5
index 4a886cb808ca..fb7cf4369bb8 100644
@@ -58,11 +58,6 @@ static int imx8qxp_pxl2dpi_bridge_attach(struct drm_bridge *bridge,
 		return -EINVAL;
 	}
 
-	if (!bridge->encoder) {
-		DRM_DEV_ERROR(p2d->dev, "missing encoder\n");
-		return -ENODEV;
-	}
-
 	return drm_bridge_attach(bridge->encoder,
 				 p2d->next_bridge, bridge,
 				 DRM_BRIDGE_ATTACH_NO_CONNECTOR);
Signature · 1 line
2.43.0
#12 lore raw

PATCH v2 12/12 drm/bridge: analogix: Remove redundant checks on existence of bridge->encoder

In reply to Sui Jingfeng

The checks on the existence of bridge->encoder in the implementation of drm_bridge_funcs::attach() is not necessary, as it has already been checked in the drm_bridge_attach() function call by previous bridge or KMS driver. The drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons, hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when various bridge attach functions are called.

Remove the redundant checking codes "if (!bridge->encoder) { ... }".

---
 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c |  5 -----
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c |  5 -----
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  5 -----
 drivers/gpu/drm/bridge/analogix/anx7625.c          | 10 ----------
 4 files changed, 25 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +0 -5
index c9e35731e6a1..cfe43d2ca3be 100644
@@ -528,11 +528,6 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge,
 		return -EINVAL;
 	}
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	/* Register aux channel */
 	anx6345->aux.name = "DP-AUX";
 	anx6345->aux.dev = &anx6345->client->dev;
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +0 -5
index 5748a8581af4..58875dde496f 100644
@@ -897,11 +897,6 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge,
 		return -EINVAL;
 	}
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	/* Register aux channel */
 	anx78xx->aux.name = "DP-AUX";
 	anx78xx->aux.dev = &anx78xx->client->dev;
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +0 -5
index df9370e0ff23..7b841232321f 100644
@@ -1228,11 +1228,6 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge,
 		return -EINVAL;
 	}
 
-	if (!bridge->encoder) {
-		DRM_ERROR("Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	if (!dp->plat_data->skip_connector) {
 		connector = &dp->connector;
 		connector->polled = DRM_CONNECTOR_POLL_HPD;
drivers/gpu/drm/bridge/analogix/anx7625.c +0 -10
index 59e9ad349969..3d09efa4199c 100644
@@ -2193,11 +2193,6 @@ static int anx7625_bridge_attach(struct drm_bridge *bridge,
 	if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
 		return -EINVAL;
 
-	if (!bridge->encoder) {
-		DRM_DEV_ERROR(dev, "Parent encoder object not found");
-		return -ENODEV;
-	}
-
 	ctx->aux.drm_dev = bridge->dev;
 	err = drm_dp_aux_register(&ctx->aux);
 	if (err) {
@@ -2435,11 +2430,6 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,
 
 	dev_dbg(dev, "drm atomic enable\n");
 
-	if (!bridge->encoder) {
-		dev_err(dev, "Parent encoder object not found");
-		return;
-	}
-
 	connector = drm_atomic_get_new_connector_for_encoder(state->base.state,
 							     bridge->encoder);
 	if (!connector)
Signature · 1 line
2.43.0
maintainer Applied
#13 lore raw
In reply to Sui Jingfeng
Quoted 9 lines · Sui Jingfeng

The checks on the existence of bridge->encoder in the implementation of drm_bridge_funcs::attach() is not necessary, as it has already been checked in the drm_bridge_attach() function call by previous bridge or KMS driver. The drm_bridge_attach() will quit with a negative error code returned if it fails for some reasons, hence, it is guaranteed that the .encoder member of the drm_bridge instance is not NULL when various bridge attach functions are called.

[...]

Applied, thanks!

[01/12] drm/bridge: simple-bridge: Remove a redundant check on existence of bridge->encoder

        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=f0a83a2cf9eb
[02/12] drm/bridge: tfp410: Remove a redundant check on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=482ade3ec1c5
[03/12] drm/bridge: nxp-ptn3460: Remove a redundant check on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=0f4bca4e1be3
[04/12] drm/bridge: panel: Remove a redundant check on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=a8f856bf054a
[05/12] drm/bridge: it6505: Remove a redundant check on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=8761a39e3f9d
[06/12] drm/bridge: adv7511: Remove a redundant check on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=41e6ed85e457
[07/12] drm/bridge: cdns-mhdp8546: Remove a redundant check on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=b24fd6e9eb66
[08/12] drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: Remove a redundant check on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=0a59deb2fedb
[09/12] drm/bridge: synopsys: dw-mipi-dsi: Remove a redundant check on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=80221a89ff95
[10/12] drm/bridge: lt9611uxc: Remove a redundant check on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=91942a37ebba
[11/12] drm/bridge: imx: Remove redundant checks on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ec74951a7507
[12/12] drm/bridge: analogix: Remove redundant checks on existence of bridge->encoder
        https://cgit.freedesktop.org/drm/drm-misc/commit/?id=591255853a37

Rob