[prev in list] [next in list] [prev in thread] [next in thread] 

List:       dri-devel
Subject:    Re: [PATCH v10 5/9] drm/mediatek: Add connector dynamic selection capability
From:       Jason-JH Lin (林睿祥) <Jason-JH.Lin () mediatek ! com>
Date:       2023-10-03 3:34:10
Message-ID: 7855953c52961f3d1d9992f0b4303eadee3fe724.camel () mediatek ! com
[Download RAW message or body]

[Attachment #2 (text/html)]

<pre>
Hi&#32;Angelo,

Thanks&#32;for&#32;the&#32;reviews.

[snip]

&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;
&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;+
&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;+if&#32;(ret&#32;&lt;=&#32;0)&#32;{
&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;+DRM_INFO(&quot;Failed&#32;to&#32;find&#32;comp&#32;in&#32;ddp&#32;table,&#32;ret
 &gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;=%d&#92;n&quot;,
&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;ret);
&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;+ret&#32;=&#32;0;
&gt;&#32;&gt;&#32;&gt;&#32;
&gt;&#32;&gt;&#32;&gt;&#32;Why&#32;are&#32;you&#32;returning&#32;0&#32;for&#32;error&#32;here&#63;!
 &gt;&#32;&gt;&#32;
&gt;&#32;&gt;&#32;Because&#32;this&#32;function&#32;return&#32;0&#32;means&#32;not&#32;found&#32;any&#32;valid&#32;crtc&#32;bits.
 &gt;&#32;&gt;&#32;Should&#32;I&#32;change&#32;this&#63;
&gt;&#32;&gt;&#32;
&gt;&#32;
&gt;&#32;Yes,&#32;please,&#32;return&#32;a&#32;relevant&#32;error&#32;code&#32;instead.
 &gt;&#32;

I&#32;found&#32;that&#32;the&#32;return&#32;type&#32;of&#32;this&#32;function&#32;is&#32;&#39;unsigned&#32;int&#39;,&#32;I
 think&#32;returning&#32;error&#32;code&#32;instead&#32;will&#32;change&#32;the&#32;original&#32;behavior&#32;of
 returning&#32;0&#32;as&#32;not&#32;finding&#32;any&#32;possible&#32;crtc.

e.g.&#32;drm_encoder_ok()&#32;in&#32;drm_encoder.h&#32;will&#32;check:
!!(encoder-&gt;possible_crtcs&#32;&amp;&#32;drm_crtc_mask(crtc))

The&#32;negative&#32;error&#32;code&#32;convert&#32;to&#32;unsigned&#32;int&#32;will&#32;be&#32;a&#32;huge&#32;number
 and&#32;that&#32;may&#32;cause&#32;the&#32;unexpected&#32;result&#32;here.

Regards,
Jason-JH.Lin

&gt;&#32;Thanks,
&gt;&#32;Angelo
&gt;&#32;
&gt;&#32;&gt;&#32;Regards,
&gt;&#32;&gt;&#32;Jason-JH.Lin
&gt;&#32;&gt;&#32;
&gt;&#32;&gt;&#32;&gt;&#32;
&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;+}
&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;&#32;&#32;&#32;
&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;&#32;&#32;&#32;return&#32;ret;
&gt;&#32;&gt;&#32;&gt;&#32;&gt;&#32;&#32;&#32;&#32;}
&gt;&#32;&gt;&#32;&gt;&#32;
&gt;&#32;&gt;&#32;&gt;&#32;Regards,
&gt;&#32;&gt;&#32;&gt;&#32;Angelo
&gt;&#32;&gt;&#32;&gt;&#32;
&gt;&#32;
&gt;&#32;
&gt;&#32;

</pre><!--type:text--><!--{--><pre>************* MEDIATEK Confidentiality Notice \
******************** The information contained in this e-mail message (including any 
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be 
conveyed only to the designated recipient(s). Any use, dissemination, 
distribution, printing, retaining or copying of this e-mail (including its 
attachments) by unintended recipient(s) is strictly prohibited and may 
be unlawful. If you are not an intended recipient of this e-mail, or believe 
that you have received this e-mail in error, please notify the sender 
immediately (by replying to this e-mail), delete any and all copies of 
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!
</pre><!--}-->


[Attachment #3 (text/plain)]

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
> > > 
> 
> 
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic