[PATCH] drm/xe/query: zero the engine info

Nirmoy Das nirmoy.das at intel.com
Wed Jan 31 05:21:27 UTC 2024


On 1/30/2024 11:03 PM, Matthew Brost wrote:
> On Tue, Jan 30, 2024 at 04:51:22PM +0100, Nirmoy Das wrote:
>> Use kzalloc like other routines for better consistency.
>>
>> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
> Maybe s/zero the engine info/Use kzalloc for drm_xe_query_engines
Better, I will resend.
>
> With that:
> Reviewed-by: Matthew Brost <matthew.brost at intel.com>

Thanks,

Nirmoy

>
>> ---
>>   drivers/gpu/drm/xe/xe_query.c | 6 +-----
>>   1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
>> index 9b35673b286c..02a4e2c083e4 100644
>> --- a/drivers/gpu/drm/xe/xe_query.c
>> +++ b/drivers/gpu/drm/xe/xe_query.c
>> @@ -198,7 +198,7 @@ static int query_engines(struct xe_device *xe,
>>   		return -EINVAL;
>>   	}
>>   
>> -	engines = kmalloc(size, GFP_KERNEL);
>> +	engines = kzalloc(size, GFP_KERNEL);
>>   	if (!engines)
>>   		return -ENOMEM;
>>   
>> @@ -212,14 +212,10 @@ static int query_engines(struct xe_device *xe,
>>   			engines->engines[i].instance.engine_instance =
>>   				hwe->logical_instance;
>>   			engines->engines[i].instance.gt_id = gt->info.id;
>> -			engines->engines[i].instance.pad = 0;
>> -			memset(engines->engines[i].reserved, 0,
>> -			       sizeof(engines->engines[i].reserved));
>>   
>>   			i++;
>>   		}
>>   
>> -	engines->pad = 0;
>>   	engines->num_engines = i;
>>   
>>   	if (copy_to_user(query_ptr, engines, size)) {
>> -- 
>> 2.42.0
>>


More information about the Intel-xe mailing list