All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: remove no need NULL check before kfree
@ 2021-11-16  1:47 Bernard Zhao
  2021-11-17 21:37   ` Alex Deucher
  0 siblings, 1 reply; 4+ messages in thread
From: Bernard Zhao @ 2021-11-16  1:47 UTC (permalink / raw)
  To: Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, Pan, Xinhui, David Airlie, Daniel Vetter,
	Solomon Chiu, Li, Roman, Dmytro Laktyushkin, Eric Bernstein,
	Bernard Zhao, Atufa Khan, Jimmy Kizito, amd-gfx, dri-devel,
	linux-kernel

This change is to cleanup the code a bit.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 .../drm/amd/display/dc/dcn10/dcn10_resource.c  | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

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 f37551e00023..0090550d4aee 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
@@ -978,10 +978,8 @@ static void dcn10_resource_destruct(struct dcn10_resource_pool *pool)
 		pool->base.mpc = NULL;
 	}
 
-	if (pool->base.hubbub != NULL) {
-		kfree(pool->base.hubbub);
-		pool->base.hubbub = NULL;
-	}
+	kfree(pool->base.hubbub);
+	pool->base.hubbub = NULL;
 
 	for (i = 0; i < pool->base.pipe_count; i++) {
 		if (pool->base.opps[i] != NULL)
@@ -1011,14 +1009,10 @@ static void dcn10_resource_destruct(struct dcn10_resource_pool *pool)
 	for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
 		if (pool->base.engines[i] != NULL)
 			dce110_engine_destroy(&pool->base.engines[i]);
-		if (pool->base.hw_i2cs[i] != NULL) {
-			kfree(pool->base.hw_i2cs[i]);
-			pool->base.hw_i2cs[i] = NULL;
-		}
-		if (pool->base.sw_i2cs[i] != NULL) {
-			kfree(pool->base.sw_i2cs[i]);
-			pool->base.sw_i2cs[i] = NULL;
-		}
+		kfree(pool->base.hw_i2cs[i]);
+		pool->base.hw_i2cs[i] = NULL;
+		kfree(pool->base.sw_i2cs[i]);
+		pool->base.sw_i2cs[i] = NULL;
 	}
 
 	for (i = 0; i < pool->base.audio_count; i++) {
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amd/display: remove no need NULL check before kfree
  2021-11-16  1:47 [PATCH] drm/amd/display: remove no need NULL check before kfree Bernard Zhao
  2021-11-17 21:37   ` Alex Deucher
@ 2021-11-17 21:37   ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2021-11-17 21:37 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: Solomon Chiu, Leo Li, Pan, Xinhui, Rodrigo Siqueira, Li, Roman,
	amd-gfx list, LKML, David Airlie, Atufa Khan, Dmytro Laktyushkin,
	Eric Bernstein, Maling list - DRI developers, Alex Deucher,
	Christian König, Jimmy Kizito

Applied.  Thanks!

On Mon, Nov 15, 2021 at 8:48 PM Bernard Zhao <bernard@vivo.com> wrote:
>
> This change is to cleanup the code a bit.
>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  .../drm/amd/display/dc/dcn10/dcn10_resource.c  | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
>
> 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 f37551e00023..0090550d4aee 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
> @@ -978,10 +978,8 @@ static void dcn10_resource_destruct(struct dcn10_resource_pool *pool)
>                 pool->base.mpc = NULL;
>         }
>
> -       if (pool->base.hubbub != NULL) {
> -               kfree(pool->base.hubbub);
> -               pool->base.hubbub = NULL;
> -       }
> +       kfree(pool->base.hubbub);
> +       pool->base.hubbub = NULL;
>
>         for (i = 0; i < pool->base.pipe_count; i++) {
>                 if (pool->base.opps[i] != NULL)
> @@ -1011,14 +1009,10 @@ static void dcn10_resource_destruct(struct dcn10_resource_pool *pool)
>         for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
>                 if (pool->base.engines[i] != NULL)
>                         dce110_engine_destroy(&pool->base.engines[i]);
> -               if (pool->base.hw_i2cs[i] != NULL) {
> -                       kfree(pool->base.hw_i2cs[i]);
> -                       pool->base.hw_i2cs[i] = NULL;
> -               }
> -               if (pool->base.sw_i2cs[i] != NULL) {
> -                       kfree(pool->base.sw_i2cs[i]);
> -                       pool->base.sw_i2cs[i] = NULL;
> -               }
> +               kfree(pool->base.hw_i2cs[i]);
> +               pool->base.hw_i2cs[i] = NULL;
> +               kfree(pool->base.sw_i2cs[i]);
> +               pool->base.sw_i2cs[i] = NULL;
>         }
>
>         for (i = 0; i < pool->base.audio_count; i++) {
> --
> 2.33.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amd/display: remove no need NULL check before kfree
@ 2021-11-17 21:37   ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2021-11-17 21:37 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: Solomon Chiu, Leo Li, Pan, Xinhui, Rodrigo Siqueira, Li, Roman,
	amd-gfx list, LKML, David Airlie, Atufa Khan, Dmytro Laktyushkin,
	Eric Bernstein, Maling list - DRI developers, Daniel Vetter,
	Alex Deucher, Harry Wentland, Christian König, Jimmy Kizito

Applied.  Thanks!

On Mon, Nov 15, 2021 at 8:48 PM Bernard Zhao <bernard@vivo.com> wrote:
>
> This change is to cleanup the code a bit.
>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  .../drm/amd/display/dc/dcn10/dcn10_resource.c  | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
>
> 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 f37551e00023..0090550d4aee 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
> @@ -978,10 +978,8 @@ static void dcn10_resource_destruct(struct dcn10_resource_pool *pool)
>                 pool->base.mpc = NULL;
>         }
>
> -       if (pool->base.hubbub != NULL) {
> -               kfree(pool->base.hubbub);
> -               pool->base.hubbub = NULL;
> -       }
> +       kfree(pool->base.hubbub);
> +       pool->base.hubbub = NULL;
>
>         for (i = 0; i < pool->base.pipe_count; i++) {
>                 if (pool->base.opps[i] != NULL)
> @@ -1011,14 +1009,10 @@ static void dcn10_resource_destruct(struct dcn10_resource_pool *pool)
>         for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
>                 if (pool->base.engines[i] != NULL)
>                         dce110_engine_destroy(&pool->base.engines[i]);
> -               if (pool->base.hw_i2cs[i] != NULL) {
> -                       kfree(pool->base.hw_i2cs[i]);
> -                       pool->base.hw_i2cs[i] = NULL;
> -               }
> -               if (pool->base.sw_i2cs[i] != NULL) {
> -                       kfree(pool->base.sw_i2cs[i]);
> -                       pool->base.sw_i2cs[i] = NULL;
> -               }
> +               kfree(pool->base.hw_i2cs[i]);
> +               pool->base.hw_i2cs[i] = NULL;
> +               kfree(pool->base.sw_i2cs[i]);
> +               pool->base.sw_i2cs[i] = NULL;
>         }
>
>         for (i = 0; i < pool->base.audio_count; i++) {
> --
> 2.33.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/amd/display: remove no need NULL check before kfree
@ 2021-11-17 21:37   ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2021-11-17 21:37 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: Harry Wentland, Leo Li, Rodrigo Siqueira, Alex Deucher,
	Christian König, Pan, Xinhui, David Airlie, Daniel Vetter,
	Solomon Chiu, Li, Roman, Dmytro Laktyushkin, Eric Bernstein,
	Atufa Khan, Jimmy Kizito, amd-gfx list,
	Maling list - DRI developers, LKML

Applied.  Thanks!

On Mon, Nov 15, 2021 at 8:48 PM Bernard Zhao <bernard@vivo.com> wrote:
>
> This change is to cleanup the code a bit.
>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  .../drm/amd/display/dc/dcn10/dcn10_resource.c  | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
>
> 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 f37551e00023..0090550d4aee 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
> @@ -978,10 +978,8 @@ static void dcn10_resource_destruct(struct dcn10_resource_pool *pool)
>                 pool->base.mpc = NULL;
>         }
>
> -       if (pool->base.hubbub != NULL) {
> -               kfree(pool->base.hubbub);
> -               pool->base.hubbub = NULL;
> -       }
> +       kfree(pool->base.hubbub);
> +       pool->base.hubbub = NULL;
>
>         for (i = 0; i < pool->base.pipe_count; i++) {
>                 if (pool->base.opps[i] != NULL)
> @@ -1011,14 +1009,10 @@ static void dcn10_resource_destruct(struct dcn10_resource_pool *pool)
>         for (i = 0; i < pool->base.res_cap->num_ddc; i++) {
>                 if (pool->base.engines[i] != NULL)
>                         dce110_engine_destroy(&pool->base.engines[i]);
> -               if (pool->base.hw_i2cs[i] != NULL) {
> -                       kfree(pool->base.hw_i2cs[i]);
> -                       pool->base.hw_i2cs[i] = NULL;
> -               }
> -               if (pool->base.sw_i2cs[i] != NULL) {
> -                       kfree(pool->base.sw_i2cs[i]);
> -                       pool->base.sw_i2cs[i] = NULL;
> -               }
> +               kfree(pool->base.hw_i2cs[i]);
> +               pool->base.hw_i2cs[i] = NULL;
> +               kfree(pool->base.sw_i2cs[i]);
> +               pool->base.sw_i2cs[i] = NULL;
>         }
>
>         for (i = 0; i < pool->base.audio_count; i++) {
> --
> 2.33.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-17 21:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16  1:47 [PATCH] drm/amd/display: remove no need NULL check before kfree Bernard Zhao
2021-11-17 21:37 ` Alex Deucher
2021-11-17 21:37   ` Alex Deucher
2021-11-17 21:37   ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.