Re: [PATCH] drm/mediatek: Only try to attach bridge if there is one

From: CK Hu
Date: Sun Dec 02 2018 - 22:29:07 EST


Hi, Nicolas:

On Mon, 2018-11-26 at 13:30 +0800, CK Hu wrote:
> Hi, Nicolas:
>
> On Mon, 2018-11-26 at 12:07 +0800, Nicolas Boichat wrote:
> > Even if dsi->bridge is NULL, we still try to call drm_bridge_attach,
> > and print out an error message, before creating the connector.
> >
> > When no bridge is provided, let's skip these 2 steps and directly
> > create the connector.
>

Applied to mediatek-drm-fixes-4.20 [1], thanks.

[1]
https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-fixes-4.20

Regards,
CK

> Reviewed-by: CK Hu <ck.hu@xxxxxxxxxxxx>
>
> >
> > Signed-off-by: Nicolas Boichat <drinkcat@xxxxxxxxxxxx>
> > ---
> > drivers/gpu/drm/mediatek/mtk_dsi.c | 11 +++++++----
> > 1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index 66df1b17795921..27b507eb4a997d 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -818,10 +818,13 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
> > dsi->encoder.possible_crtcs = 1;
> >
> > /* If there's a bridge, attach to it and let it create the connector */
> > - ret = drm_bridge_attach(&dsi->encoder, dsi->bridge, NULL);
> > - if (ret) {
> > - DRM_ERROR("Failed to attach bridge to drm\n");
> > -
> > + if (dsi->bridge) {
> > + ret = drm_bridge_attach(&dsi->encoder, dsi->bridge, NULL);
> > + if (ret) {
> > + DRM_ERROR("Failed to attach bridge to drm\n");
> > + goto err_encoder_cleanup;
> > + }
> > + } else {
> > /* Otherwise create our own connector and attach to a panel */
> > ret = mtk_dsi_create_connector(drm, dsi);
> > if (ret)
>