Re: [PATCH v10 5/9] drm/mediatek: Add connector dynamic selection capability
From: Jason-JH Lin (林睿祥)
Date: Mon Oct 02 2023 - 23:34:23 EST
Hi Angelo,
Thanks for the reviews.
[snip]
> > > >
> > > > +
> > > > + if (ret <= 0) {
> > > > + DRM_INFO("Failed to find comp in ddp table, ret
> > > > =%d\n",
> > > > ret);
> > > > + ret = 0;
> > >
> > > Why are you returning 0 for error here?!
> >
> > Because this function return 0 means not found any valid crtc bits.
> > Should I change this?
> >
>
> Yes, please, return a relevant error code instead.
>
I found that the return type of this function is 'unsigned int', I
think returning error code instead will change the original behavior of
returning 0 as not finding any possible crtc.
e.g. drm_encoder_ok() in drm_encoder.h will check:
!!(encoder->possible_crtcs & drm_crtc_mask(crtc))
The negative error code convert to unsigned int will be a huge number
and that may cause the unexpected result here.
Regards,
Jason-JH.Lin
> Thanks,
> Angelo
>
> > Regards,
> > Jason-JH.Lin
> >
> > >
> > > > + }
> > > >
> > > > return ret;
> > > > }
> > >
> > > Regards,
> > > Angelo
> > >
>
>
>