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

Tomi Valkeinen tomi.valkeinen at ti.com
Fri Sep 25 07:36:44 UTC 2020


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.

Anyway, I'd like to merge this fix as it is to get rid of the warning for the merge window.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


More information about the dri-devel mailing list