[PATCH] drm/amd/display: remove redundant null pointer check before kfree

zhong jiang zhongjiang at huawei.com
Fri Sep 21 14:10:21 UTC 2018


On 2018/9/21 21:56, Harry Wentland wrote:
> On 2018-09-21 09:12 AM, zhong jiang wrote:
>> kfree has taken the null pointer into account. hence it is safe
>> to remove the redundant null pointer check before kfree.
>>
> Please send patches for drivers/gpu/drm/amd to amd-gfx at lists.freedesktop.org for review.
+cc amd-gfx at lists.freedesktop.org. Do I need to resend it ?

Sincerely,
zhong jiang
> Harry
>
>> Signed-off-by: zhong jiang <zhongjiang at huawei.com>
>> ---
>>  drivers/gpu/drm/amd/display/modules/stats/stats.c | 8 ++------
>>  1 file changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/modules/stats/stats.c b/drivers/gpu/drm/amd/display/modules/stats/stats.c
>> index 3d4c1b1..03121ca 100644
>> --- a/drivers/gpu/drm/amd/display/modules/stats/stats.c
>> +++ b/drivers/gpu/drm/amd/display/modules/stats/stats.c
>> @@ -186,12 +186,8 @@ void mod_stats_destroy(struct mod_stats *mod_stats)
>>  	if (mod_stats != NULL) {
>>  		struct core_stats *core_stats = MOD_STATS_TO_CORE(mod_stats);
>>  
>> -		if (core_stats->time != NULL)
>> -			kfree(core_stats->time);
>> -
>> -		if (core_stats->events != NULL)
>> -			kfree(core_stats->events);
>> -
>> +		kfree(core_stats->time);
>> +		kfree(core_stats->events);
>>  		kfree(core_stats);
>>  	}
>>  }
>>
>




More information about the amd-gfx mailing list