[PATCH] drm/msm/dpu: signedness bug in dpu_encoder_phys_cmd_tearcheck_config()

Dan Carpenter dan.carpenter at linaro.org
Tue May 23 10:54:23 UTC 2023


On Mon, May 22, 2023 at 10:47:50AM +0200, Marijn Suijten wrote:
> On 2023-05-22 10:48:01, Dan Carpenter wrote:
> > The "vsync_hz" variable is used to store negative error codes so it
> > needs to be signed for the error checking to work correctly.
> 
> Nicely spotted, but it it looks like we have more to fix then.  The type
> returned by dpu_kms_get_clk_rate() is u64:
> 

That's a good point.  Although the type of clk_get_rate() is unsigned
long so probably unsigned long is enough.

> - Perhaps the int used in this patch is too small (though 19.2MHz vsync
>   clock ought to fit);
> - That function should also return a signed number as part of this
>   contract.

What about if we just return 0 instead of -EINVAL?  That would match
what clk_get_rate() does.  Also let me change the type to unsigned long.

regards,
dan carpenter


More information about the dri-devel mailing list