All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Deucher <alexander.deucher@amd.com>,
	Harry Wentland <harry.wentland@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	"Tony Cheng" <tony.cheng@amd.com>,
	"Dmytro Laktyushkin" <Dmytro.Laktyushkin@amd.com>,
	"Hersen Wu" <hersenxs.wu@amd.com>,
	"Dave Airlie" <airlied@redhat.com>,
	"Andrey Grodzovsky" <Andrey.Grodzovsky@amd.com>,
	"Bhawanpreet Lakha" <Bhawanpreet.Lakha@amd.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH] drm/amd/display: small cleanup in destruct()
Date: Mon, 06 Nov 2017 07:07:33 +0000	[thread overview]
Message-ID: <20171106070733.owgzad3bpuabfkkk@mwanda> (raw)
In-Reply-To: <e32e3d91-bfdf-5c4b-afb2-2472efeb1079@amd.com>

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

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])

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Deucher <alexander.deucher@amd.com>,
	Harry Wentland <harry.wentland@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	"Tony Cheng" <tony.cheng@amd.com>,
	"Dmytro Laktyushkin" <Dmytro.Laktyushkin@amd.com>,
	"Hersen Wu" <hersenxs.wu@amd.com>,
	"Dave Airlie" <airlied@redhat.com>,
	"Andrey Grodzovsky" <Andrey.Grodzovsky@amd.com>,
	"Bhawanpreet Lakha" <Bhawanpreet.Lakha@amd.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH] drm/amd/display: small cleanup in destruct()
Date: Mon, 6 Nov 2017 10:07:33 +0300	[thread overview]
Message-ID: <20171106070733.owgzad3bpuabfkkk@mwanda> (raw)
In-Reply-To: <e32e3d91-bfdf-5c4b-afb2-2472efeb1079@amd.com>

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

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])

  reply	other threads:[~2017-11-06  7:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-04  6:12 [PATCH] drm/amd/display: indent an if statement Dan Carpenter
2017-11-04  6:12 ` Dan Carpenter
2017-11-04  9:16 ` walter harms
2017-11-04  9:16   ` walter harms
     [not found]   ` <59FD8567.4030500-fPG8STNUNVg@public.gmane.org>
2017-11-04 10:07     ` Christian König
2017-11-04 10:07       ` Christian König
2017-11-06  7:07       ` Dan Carpenter [this message]
2017-11-06  7:07         ` [PATCH] drm/amd/display: small cleanup in destruct() Dan Carpenter
2017-11-06  8:44         ` Christian König
2017-11-06  8:44           ` Christian König
2017-11-06 21:29           ` Alex Deucher
2017-11-06 21:29             ` Alex Deucher
2017-11-06  6:42   ` [PATCH] drm/amd/display: indent an if statement Dan Carpenter
2017-11-06  6:42     ` Dan Carpenter
2018-08-14  9:09 ` Dan Carpenter
2018-08-14  9:09   ` Dan Carpenter
     [not found]   ` <20180814090944.qjm4vxyrjdqxu4d7-vMlZ3nK25oGAIHFoDFOv9A@public.gmane.org>
2018-08-21 18:51     ` Harry Wentland
2018-08-21 18:51       ` Harry Wentland
2020-08-03 14:35 ` [PATCH] drm/amd/display: Indent " Dan Carpenter
2020-08-03 14:35   ` Dan Carpenter
2020-08-04 20:33   ` Alex Deucher
2020-08-04 20:33     ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171106070733.owgzad3bpuabfkkk@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Andrey.Grodzovsky@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Dmytro.Laktyushkin@amd.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=hersenxs.wu@amd.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=tony.cheng@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.