[Mesa-dev] [PATCH] gallium: fix clang warnings

Nicolai Hähnle nhaehnle at gmail.com
Wed Sep 7 08:12:51 UTC 2016


On 07.09.2016 09:38, Michel Dänzer wrote:
> On 07/09/16 12:29 AM, Nicolai Hähnle wrote:
>> On 06.09.2016 16:37, Martina Kollarova wrote:
>>> 1. Variable 'hole' is uninitialized when used here [-Wuninitialized]
>>> 2. Comparison of constant -1 with expression of type 'unsigned int' is
>>> always
>>>    false [-Wtautological-constant-out-of-range-compare]
>>> ---
>>>  src/gallium/winsys/radeon/drm/radeon_drm_bo.c     | 2 +-
>>>  src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 5 -----
>
> BTW, please split this up into one patch per component next time.
>
>
>>> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
>>> b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
>>> index 56aab48..23ee8d5 100644
>>> --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
>>> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
>>> @@ -200,7 +200,7 @@ static uint64_t radeon_bomgr_find_va(struct
>>> radeon_drm_winsys *rws,
>>>  static void radeon_bomgr_free_va(struct radeon_drm_winsys *rws,
>>>                                   uint64_t va, uint64_t size)
>>>  {
>>> -    struct radeon_bo_va_hole *hole;
>>> +    struct radeon_bo_va_hole *hole = NULL;
>>
>> This is a false positive, [...]
>
> That's debatable, but anyway it's probably better addressed by porting
> https://cgit.freedesktop.org/mesa/drm/commit/?id=b214b05ccd433c484a6a65e491a1a51b19e4811d
> to src/util/list.h .

You're right, that should fix it. Separately, it might be a good idea to 
move the declaration of hole down into the scopes where it's actually used.

Nicolai

>


More information about the mesa-dev mailing list