Re: [PATCH] drm: bridge: cdns-mhdp8546: fix compile warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux