]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/bridge: imx: Remove redundant checks on existence of bridge->encoder
authorSui Jingfeng <sui.jingfeng@linux.dev>
Mon, 13 May 2024 15:31:08 +0000 (23:31 +0800)
committerRobert Foss <rfoss@kernel.org>
Mon, 13 May 2024 16:31:12 +0000 (18:31 +0200)
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) { ... }".

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240513153109.46786-12-sui.jingfeng@linux.dev
drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c

index 6967325cd8ee0df88294aae31fbbd85d24e733df..9b5bebbe357dd4905a792abc5cecdbb9ce10ffb8 100644 (file)
@@ -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);
index d0868a6ac6c91f081790ad5a0bbce3c8fbc4d498..e6dbbdc87ce29f4c9ea5767d5f77d176043ca5f6 100644 (file)
@@ -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);
index ed8b7a4e0e11fd6ac2c3a0ccd1e6edb84c9f5bdb..1d11cc1df43c06b3b894466e957561c73ce143e4 100644 (file)
@@ -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);
index 4a886cb808caeb16de8a42db98375bc3aa2d7b22..fb7cf4369bb81d5bc5809159705e34b3a5869252 100644 (file)
@@ -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);