[PATCH] drm/amdgpu/gmc: fix compiler errors [-Werror,-Wmissing-braces]

S S
Fri Dec 21 15:47:08 UTC 2018


Have rectified it.

I had built it but seems some how i missed it while rebasing the patch 
from my internal kernel tree (which is a bit older) onto 
internal-staging tip.

Apologies for the troubles.

Have sent V2, please review.

Regards,

Shirish S

On 12/21/2018 4:48 PM, Michel Dänzer wrote:
> On 2018-12-20 3:01 p.m., S, Shirish wrote:
>> Initializing structures with { } is known to be problematic since
>> it doesn't necessararily initializes all bytes, in case of padding,
>> causing random failures when structures are memcmp().
>>
>> This patch fixes the structure initialisation compiler error by memsetting
>> the entire structure elements instead of only the first one.
>>
>> Signed-off-by: Shirish S <shirish.s at amd.com>
>>
>> [...]
>>   
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>> index bacdaef..2bfddce 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
>> @@ -320,8 +320,9 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,
>>   	}
>>   
>>   	if (printk_ratelimit()) {
>> -		struct amdgpu_task_info task_info = { 0 };
>> +		struct amdgpu_task_info task_info;
>>   
>> +		memset(&task_info, 0, sizeof(amdgpu_task_info));
> This doesn't compile:
>
> drivers/gpu/drm//amd/amdgpu/gmc_v9_0.c: In function ‘gmc_v9_0_process_interrupt’:
> drivers/gpu/drm//amd/amdgpu/gmc_v9_0.c:325:32: error: ‘amdgpu_task_info’ undeclared (first use in this function)
>     memset(&task_info, 0, sizeof(amdgpu_task_info));
>                                  ^~~~~~~~~~~~~~~~
>
> (Needs to be "sizeof(struct amdgpu_task_info)")
>
>
> I've reverted this on the internal amd-staging-drm-next branch.
>
> Patches must be tested appropriately (against the target branch),
> ideally before submitting them for review. Reviewers are not expected to
> look for things which trivially break the build.
>
>
-- 
Regards,
Shirish S



More information about the amd-gfx mailing list