[PATCH 2/4] drm: Help unconfuse gcc, avoid accidental impossible unsigned comparisons

Chris Wilson chris at chris-wilson.co.uk
Mon May 18 14:53:28 UTC 2020


Quoting Daniel Vetter (2020-05-18 15:47:44)
> On Sat, May 16, 2020 at 10:23:28PM +0100, Chris Wilson wrote:
> > drivers/gpu/drm/drm_client_modeset.c: In function ‘drm_client_firmware_config’:
> > ./include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
> >    __builtin_constant_p((l) > (h)), (l) > (h), 0)))
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> 
> Took me a while to spot where this goes boom, kinda wonder whether we
> should have an
> 
>         if (WARN_ON(!connector_count))
>                 return -EINVAL;

Atm, drm_client_firmware_config() is called only if connector_count!=0.
But if count==0, we would hit goto retry indefinitely, seems like that
would be worth a WARN.
-Chris


More information about the dri-devel mailing list