[PATCH] drm: bridge: cdns-mhdp8546: fix compile warning
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Sep 25 12:00:18 UTC 2020
On Fri, Sep 25, 2020 at 10:36:44AM +0300, Tomi Valkeinen wrote:
> On 24/09/2020 14:48, Laurent Pinchart wrote:
> > Hi Tomi,
> >
> > Thank you for the patch.
> >
> > On Wed, Sep 23, 2020 at 11:30:57AM +0300, Tomi Valkeinen wrote:
> >> On x64 we get:
> >>
> >> drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c:751:10: warning: conversion from 'long unsigned int' to 'unsigned int' changes value from '18446744073709551613' to '4294967293' [-Woverflow]
> >>
> >> The registers are 32 bit, so fix by casting to u32.
> >
> > I wonder if we need a BIT32 macro... This is a common issue, it would be
> > nice to handle it in the macros that define register fields.
>
> That's probably a good idea. I think
>
> #define BIT32(nr) (1u << (nr))
>
> should work correct on all archs. Although I'm not quite sure if nr should be cast to u32, but in my
> tests a u64 nr doesn't cause type promotion to u64.
I don't think we need to support nr values larger than 2^32-1 ;-)
> Anyway, I'd like to merge this fix as it is to get rid of the warning for the merge window.
Sounds good to me.
--
Regards,
Laurent Pinchart
More information about the dri-devel
mailing list