diff mbox

drm/amd/display: small cleanup in destruct()

Message ID 20171106070733.owgzad3bpuabfkkk@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Nov. 6, 2017, 7:07 a.m. UTC
Static analysis tools get annoyed that we don't indent this if
statement.  Actually, the if statement isn't required because kfree()
can handle NULL pointers just fine.  The DCE110STRENC_FROM_STRENC()
macro is a wrapper around container_of() but it's basically a no-op or a
cast.  Anyway, it's not really appropriate here so it should be removed
as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: in v1 I just added a tab

Comments

Christian König Nov. 6, 2017, 8:44 a.m. UTC | #1
Am 06.11.2017 um 08:07 schrieb Dan Carpenter:
> Static analysis tools get annoyed that we don't indent this if
> statement.  Actually, the if statement isn't required because kfree()
> can handle NULL pointers just fine.  The DCE110STRENC_FROM_STRENC()
> macro is a wrapper around container_of() but it's basically a no-op or a
> cast.  Anyway, it's not really appropriate here so it should be removed
> as well.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
> v2: in v1 I just added a tab
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
> index d911590d08bc..4c4bd72d4e40 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
> @@ -725,10 +725,8 @@ static void destruct(struct dcn10_resource_pool *pool)
>   		}
>   	}
>   
> -	for (i = 0; i < pool->base.stream_enc_count; i++) {
> -		if (pool->base.stream_enc[i] != NULL)
> -		kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
> -	}
> +	for (i = 0; i < pool->base.stream_enc_count; i++)
> +		kfree(pool->base.stream_enc[i]);
>   
>   	for (i = 0; i < pool->base.audio_count; i++) {
>   		if (pool->base.audios[i])
Alex Deucher Nov. 6, 2017, 9:29 p.m. UTC | #2
On Mon, Nov 6, 2017 at 3:44 AM, Christian König
<christian.koenig@amd.com> wrote:
> Am 06.11.2017 um 08:07 schrieb Dan Carpenter:
>>
>> Static analysis tools get annoyed that we don't indent this if
>> statement.  Actually, the if statement isn't required because kfree()
>> can handle NULL pointers just fine.  The DCE110STRENC_FROM_STRENC()
>> macro is a wrapper around container_of() but it's basically a no-op or a
>> cast.  Anyway, it's not really appropriate here so it should be removed
>> as well.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>
> Acked-by: Christian König <christian.koenig@amd.com>

Applied.  thanks!

Alex


>
>> ---
>> v2: in v1 I just added a tab
>>
>> diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
>> b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
>> index d911590d08bc..4c4bd72d4e40 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
>> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
>> @@ -725,10 +725,8 @@ static void destruct(struct dcn10_resource_pool
>> *pool)
>>                 }
>>         }
>>   -     for (i = 0; i < pool->base.stream_enc_count; i++) {
>> -               if (pool->base.stream_enc[i] != NULL)
>> -               kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
>> -       }
>> +       for (i = 0; i < pool->base.stream_enc_count; i++)
>> +               kfree(pool->base.stream_enc[i]);
>>         for (i = 0; i < pool->base.audio_count; i++) {
>>                 if (pool->base.audios[i])
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
index d911590d08bc..4c4bd72d4e40 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
@@ -725,10 +725,8 @@  static void destruct(struct dcn10_resource_pool *pool)
 		}
 	}
 
-	for (i = 0; i < pool->base.stream_enc_count; i++) {
-		if (pool->base.stream_enc[i] != NULL)
-		kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
-	}
+	for (i = 0; i < pool->base.stream_enc_count; i++)
+		kfree(pool->base.stream_enc[i]);
 
 	for (i = 0; i < pool->base.audio_count; i++) {
 		if (pool->base.audios[i])