AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Alvin Lee" <alvin.lee2@amd.com>,
	"Anthony Koo" <Anthony.Koo@amd.com>,
	"Aric Cyr" <aric.cyr@amd.com>,
	"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
	"Bhawanpreet Lakha" <Bhawanpreet.Lakha@amd.com>,
	"Chiawen Huang" <chiawen.huang@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Harry Wentland" <harry.wentland@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Nicholas Kazlauskas" <nicholas.kazlauskas@amd.com>,
	"Yongqiang Sun" <yongqiang.sun@amd.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"David Airlie" <airlied@linux.ie>
Cc: kernel-janitors@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] drm/amd/display: Return directly after a failed kzalloc() in dc_create()
Date: Sat, 19 Dec 2020 18:46:29 +0100	[thread overview]
Message-ID: <7a9d62c6-b3f5-d185-3436-2cbc08ff1253@web.de> (raw)
In-Reply-To: <98e71ee7-1eb9-ada8-a438-703be03e96d1@web.de>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 19 Dec 2020 18:04:33 +0100

* Return directly after a call of the function “kzalloc” failed
  at the beginning.

* Delete a label which became unnecessary with this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 7339d9855ec8..e35fbfcb4d0e 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -964,8 +964,8 @@ struct dc *dc_create(const struct dc_init_data *init_params)
 	struct dc *dc = kzalloc(sizeof(*dc), GFP_KERNEL);
 	unsigned int full_pipe_count;

-	if (NULL == dc)
-		goto alloc_fail;
+	if (!dc)
+		return NULL;

 	if (init_params->dce_environment == DCE_ENV_VIRTUAL_HW) {
 		if (false == dc_construct_ctx(dc, init_params)) {
@@ -1009,8 +1009,6 @@ struct dc *dc_create(const struct dc_init_data *init_params)

 construct_fail:
 	kfree(dc);
-
-alloc_fail:
 	return NULL;
 }

--
2.29.2

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

  reply	other threads:[~2020-12-20 11:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-19 17:44 [PATCH 0/2] drm/amd/display: Adjustments for dc_create() Markus Elfring
2020-12-19 17:46 ` Markus Elfring [this message]
2020-12-19 17:48 ` [PATCH 2/2] drm/amd/display: Use common error handling code in dc_create() Markus Elfring
2020-12-22 15:08 ` [PATCH 0/2] drm/amd/display: Adjustments for dc_create() 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=7a9d62c6-b3f5-d185-3436-2cbc08ff1253@web.de \
    --to=markus.elfring@web.de \
    --cc=Anthony.Koo@amd.com \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=alvin.lee2@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=aric.cyr@amd.com \
    --cc=aurabindo.pillai@amd.com \
    --cc=chiawen.huang@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicholas.kazlauskas@amd.com \
    --cc=sunpeng.li@amd.com \
    --cc=yongqiang.sun@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox