[Intel-gfx] [PATCH] drm: avoid "possible bad bitmask?" warning

Daniel Vetter daniel at ffwll.ch
Tue Aug 9 20:18:52 UTC 2016


On Tue, Aug 9, 2016 at 9:53 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Tue, Aug 09, 2016 at 06:35:10PM +0100, Dave Gordon wrote:
>> Recent versions of gcc say this:
>>
>> include/drm/i915_drm.h:96:34: warning: result of β€˜65535 << 20’
>> requires 37 bits to represent, but β€˜int’ only has 32 bits
>> [-Wshift-overflow=]
>>
>> Reported-by: David Binderman <linuxdev.baldrick at gmail.com>
>> Signed-off-by: Dave Gordon <david.s.gordon at intel.com>
>> Cc: Dave Airlie <airlied at gmail.com>
>> ---
>>  include/drm/i915_drm.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
>> index b1755f8..4e1b274 100644
>> --- a/include/drm/i915_drm.h
>> +++ b/include/drm/i915_drm.h
>> @@ -93,6 +93,6 @@ extern bool i915_gpu_turbo_disable(void);
>>  #define    I845_TSEG_SIZE_1M (3 << 1)
>>
>>  #define INTEL_BSM 0x5c
>> -#define   INTEL_BSM_MASK (0xFFFF << 20)
>> +#define   INTEL_BSM_MASK     (-(1u << 20))
>
> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

And applied, thanks.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the Intel-gfx mailing list