AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 8/9] amdgpu: fixup construct to void paths on some more dc objects.
Date: Fri, 29 Sep 2017 14:34:41 +1000	[thread overview]
Message-ID: <20170929043442.7984-8-airlied@gmail.com> (raw)
In-Reply-To: <20170929043442.7984-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

From: Dave Airlie <airlied@redhat.com>

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 10 +++-------
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c   | 18 +++++-------------
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c  | 15 +++------------
 3 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index 226512c..315160d 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -245,7 +245,7 @@ void dal_ddc_aux_payloads_add(
 	}
 }
 
-static bool construct(
+static void construct(
 	struct ddc_service *ddc_service,
 	struct ddc_service_init_data *init_data)
 {
@@ -282,7 +282,6 @@ static bool construct(
 		connector_id == CONNECTOR_ID_LVDS;
 
 	ddc_service->wa.raw = 0;
-	return true;
 }
 
 struct ddc_service *dal_ddc_service_create(
@@ -295,11 +294,8 @@ struct ddc_service *dal_ddc_service_create(
 	if (!ddc_service)
 		return NULL;
 
-	if (construct(ddc_service, init_data))
-		return ddc_service;
-
-	kfree(ddc_service);
-	return NULL;
+	construct(ddc_service, init_data);
+	return ddc_service;
 }
 
 static void destruct(struct ddc_service *ddc)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index d5da847..a9919641 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -56,7 +56,7 @@ static void update_stream_signal(struct dc_stream_state *stream)
 	}
 }
 
-static bool construct(struct dc_stream_state *stream,
+static void construct(struct dc_stream_state *stream,
 	struct dc_sink *dc_sink_data)
 {
 	uint32_t i = 0;
@@ -104,7 +104,6 @@ static bool construct(struct dc_stream_state *stream,
 	stream->status.link = stream->sink->link;
 
 	update_stream_signal(stream);
-	return true;
 }
 
 static void destruct(struct dc_stream_state *stream)
@@ -142,25 +141,18 @@ struct dc_stream_state *dc_create_stream_for_sink(
 	struct dc_stream_state *stream;
 
 	if (sink == NULL)
-		goto alloc_fail;
+		return NULL;
 
 	stream = kzalloc(sizeof(struct dc_stream_state), GFP_KERNEL);
+	if (stream == NULL)
+		return NULL;
 
-	if (NULL == stream)
-		goto alloc_fail;
-
-	if (false == construct(stream, sink))
-			goto construct_fail;
+	construct(stream, sink);
 
 	atomic_inc(&stream->ref_count);
 
 	return stream;
 
-construct_fail:
-	kfree(stream);
-
-alloc_fail:
-	return NULL;
 }
 
 struct dc_stream_status *dc_stream_get_status(
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
index 511ada9..f170ae9 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -34,12 +34,11 @@
 /*******************************************************************************
  * Private functions
  ******************************************************************************/
-static bool construct(struct dc_context *ctx, struct dc_plane_state *plane_state)
+static void construct(struct dc_context *ctx, struct dc_plane_state *plane_state)
 {
 	plane_state->ctx = ctx;
 	memset(&plane_state->hdr_static_ctx,
 			0, sizeof(struct dc_hdr_static_metadata));
-	return true;
 }
 
 static void destruct(struct dc_plane_state *plane_state)
@@ -72,20 +71,12 @@ struct dc_plane_state *dc_create_plane_state(struct dc *dc)
 						     GFP_KERNEL);
 
 	if (NULL == plane_state)
-		goto alloc_fail;
-
-	if (false == construct(core_dc->ctx, plane_state))
-		goto construct_fail;
+		return NULL;
 
+	construct(core_dc->ctx, plane_state);
 	atomic_inc(&plane_state->ref_count);
 
 	return plane_state;
-
-construct_fail:
-	kfree(plane_state);
-
-alloc_fail:
-	return NULL;
 }
 
 const struct dc_plane_status *dc_plane_get_status(
-- 
2.9.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-09-29  4:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29  4:34 [PATCH 1/9] amdgpu/dc: make get_audio_clock_info return void Dave Airlie
     [not found] ` <20170929043442.7984-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-29  4:34   ` [PATCH 2/9] amdgpu/dc: make program_regamma_pwl " Dave Airlie
2017-09-29  4:34   ` [PATCH 3/9] amdgpu/dc: make some audio functions " Dave Airlie
2017-09-29  4:34   ` [PATCH 4/9] amdgpu/dc: remove pointless returns in the i2caux constructor paths Dave Airlie
2017-09-29  4:34   ` [PATCH 5/9] amdgpu/dc: cleanup construct returns in gpio Dave Airlie
2017-09-29  4:34   ` [PATCH 6/9] amdgpu/dc: another round of dce/dcn construct cleanups Dave Airlie
2017-09-29  4:34   ` [PATCH 7/9] amdgpu/dc: remove pointless return from build_pipe_hw_param Dave Airlie
2017-09-29  4:34   ` Dave Airlie [this message]
2017-09-29  4:34   ` [PATCH 9/9] amdgpu/dc: fix construct return values on irq service Dave Airlie
     [not found]     ` <20170929043442.7984-9-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-29 14:27       ` 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=20170929043442.7984-8-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox