Re: [PATCH v2 3/5] drm/msm/dp: Support up to 3 DP controllers

From: Bjorn Andersson
Date: Thu Aug 26 2021 - 12:56:07 EST


On Thu 26 Aug 00:13 PDT 2021, Stephen Boyd wrote:
> Quoting Bjorn Andersson (2021-08-25 16:42:31)
> > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
[..]
> > @@ -203,8 +204,8 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
> > dpu_debugfs_vbif_init(dpu_kms, entry);
> > dpu_debugfs_core_irq_init(dpu_kms, entry);
> >
> > - if (priv->dp)
> > - msm_dp_debugfs_init(priv->dp, minor);
> > + for (i = 0; i < ARRAY_SIZE(priv->dp); i++)
> > + msm_dp_debugfs_init(priv->dp[i], minor);
>
> Does this need the same if (!priv->dp) continue check like the other
> loops over priv->dp?
>
[..]
> > @@ -800,7 +809,8 @@ static int dpu_irq_postinstall(struct msm_kms *kms)
> > if (!priv)
> > return -EINVAL;
> >
> > - msm_dp_irq_postinstall(priv->dp);
> > + for (i = 0; i < ARRAY_SIZE(priv->dp); i++)
> > + msm_dp_irq_postinstall(priv->dp[i]);
>
> This one too? Or maybe those gained NULL pointer checks.
>

This already has a NULL check, that's why I added one to the adjacent
msm_dp_debugfs_init() as well.

> >
> > return 0;
> > }
> > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
[..]
> > @@ -1194,6 +1230,10 @@ static int dp_display_probe(struct platform_device *pdev)
> > if (!dp)
> > return -ENOMEM;
> >
> > + dp->id = dp_display_get_id(pdev);
>
> Ah ok, it's signed for this error check. Maybe assign dp->id in the
> function and return 0 instead of assigning it here?
> dp_display_assign_id()
>

I like the fact that the "getter" doesn't have side effects, but making
dp->id unsigned makes sense. So let's pay the price of a local signed
variable here.

> > + if (dp->id < 0)
> > + return -EINVAL;
> > +

Thanks for the feedback,
Bjorn