[PATCH 1/2] drm/amdgpu: individualize amdgpu entity allocation per HW IP

Luben Tuikov luben.tuikov at amd.com
Wed Jan 22 16:24:30 UTC 2020


On 2020-01-22 4:32 a.m., Nirmoy wrote:
> 
> On 1/22/20 12:34 AM, Luben Tuikov wrote:
>>
>>> +		for (j = 0; j < amdgpu_ctx_num_entities[i]; ++j) {
>>> +			struct amdgpu_ctx_entity *entity = &ctx->entities[i][j];
>>>   
>>> -		kfree(entity->fences);
>>> -		entity->fences = NULL;
>>> +			kfree(entity->fences);
>>> +			entity->fences = NULL;
>>> +		}
>>> +
>>> +error_cleanup_entity_memory:
>> "cleanup" refers to something spilled, or something to be collected.
> It is  collecting memory.

But it really is doing a "kfree()". Freeing previously allocated
memory. The traditional working is most accessible, in my opinion.

>> (Or winning in a wagered game of chance.) Also at "module_exit", maybe.
>>
>> The kernel has traditionally used "unroll" and "free" for this. Now, since
>> you're unrolling the loop (notice that it sits after the "return 0;"), then
>> you can backtrack and name it like this:
>>
>> Error_unroll_free1:
>> 	for ( ; i >= 0; i--)
>> 		free(my_array[i]);
>>
> I prefer the existing style makes it more readable.
> 
> 
> Regards,
> 
> Nirmoy
> 



More information about the amd-gfx mailing list