From: Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 2/3] amdgpu/dc: kfree already checks for NULL.
Date: Tue, 3 Oct 2017 14:27:14 +1000 [thread overview]
Message-ID: <20171003042715.9305-2-airlied@gmail.com> (raw)
In-Reply-To: <20171003042715.9305-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
From: Dave Airlie <airlied@redhat.com>
Don't bother checking for it.
Found with the cocci ifnullfree.cocci script.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/amd/display/dc/basics/vector.c | 3 +--
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 7 ++-----
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 7 ++-----
drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 3 +--
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c | 11 +++--------
5 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/basics/vector.c b/drivers/gpu/drm/amd/display/dc/basics/vector.c
index e00fc4db..217b8f1 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/vector.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/vector.c
@@ -130,8 +130,7 @@ struct vector *dal_vector_create(
void dal_vector_destruct(
struct vector *vector)
{
- if (vector->container != NULL)
- kfree(vector->container);
+ kfree(vector->container);
vector->count = 0;
vector->capacity = 0;
}
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
index 2e003b5..6d2f886 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
@@ -119,11 +119,8 @@ struct dc_bios *bios_parser_create(
static void destruct(struct bios_parser *bp)
{
- if (bp->base.bios_local_image)
- kfree(bp->base.bios_local_image);
-
- if (bp->base.integrated_info)
- kfree(bp->base.integrated_info);
+ kfree(bp->base.bios_local_image);
+ kfree(bp->base.integrated_info);
}
static void bios_parser_destroy(struct dc_bios **dcb)
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index 0c623b3..3d65e2a 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -85,11 +85,8 @@ static struct atom_encoder_caps_record *get_encoder_cap_record(
static void destruct(struct bios_parser *bp)
{
- if (bp->base.bios_local_image)
- kfree(bp->base.bios_local_image);
-
- if (bp->base.integrated_info)
- kfree(bp->base.integrated_info);
+ kfree(bp->base.bios_local_image);
+ kfree(bp->base.integrated_info);
}
static void firmware_parser_destroy(struct dc_bios **dcb)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 057bfe6..77b3474 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -159,8 +159,7 @@ void dc_destroy_resource_pool(struct dc *dc)
if (dc->res_pool)
dc->res_pool->funcs->destroy(&dc->res_pool);
- if (dc->hwseq)
- kfree(dc->hwseq);
+ kfree(dc->hwseq);
}
}
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
index 89036af..28e768d 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
@@ -619,14 +619,9 @@ void dce110_clock_source_destroy(struct clock_source **clk_src)
dce110_clk_src = TO_DCE110_CLK_SRC(*clk_src);
- if (dce110_clk_src->dp_ss_params)
- kfree(dce110_clk_src->dp_ss_params);
-
- if (dce110_clk_src->hdmi_ss_params)
- kfree(dce110_clk_src->hdmi_ss_params);
-
- if (dce110_clk_src->dvi_ss_params)
- kfree(dce110_clk_src->dvi_ss_params);
+ kfree(dce110_clk_src->dp_ss_params);
+ kfree(dce110_clk_src->hdmi_ss_params);
+ kfree(dce110_clk_src->dvi_ss_params);
kfree(dce110_clk_src);
*clk_src = NULL;
--
2.9.5
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-10-03 4:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 4:27 [PATCH 1/3] amdgpu/dc: fix a bunch of misc whitespace Dave Airlie
[not found] ` <20171003042715.9305-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-03 4:27 ` Dave Airlie [this message]
2017-10-03 4:27 ` [PATCH 3/3] amdgpu/dm: don't use after free Dave Airlie
[not found] ` <20171003042715.9305-3-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-03 15:17 ` Harry Wentland
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=20171003042715.9305-2-airlied@gmail.com \
--to=airlied-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/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.