dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org
Subject: [CI v2 11/12] drm/edid: add single point of return to drm_do_get_edid()
Date: Mon, 11 Apr 2022 12:47:32 +0300	[thread overview]
Message-ID: <1db13fe5a34c441558c2de11fec7218f22f9e43d.1649670305.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1649670305.git.jani.nikula@intel.com>

This will be useful in the future. Use fail label for fail exit.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_edid.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 5a1906a5c523..0933a5c44998 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2106,7 +2106,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
 
 	edid = drm_get_override_edid(connector);
 	if (edid)
-		return edid;
+		goto ok;
 
 	edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
 	if (!edid)
@@ -2117,7 +2117,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
 	edid_block_status_print(status, edid, 0);
 
 	if (status == EDID_BLOCK_READ_FAIL)
-		goto out;
+		goto fail;
 
 	/* FIXME: Clarify what a corrupt EDID actually means. */
 	if (status == EDID_BLOCK_OK || status == EDID_BLOCK_VERSION)
@@ -2130,15 +2130,15 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
 			connector->null_edid_counter++;
 
 		connector_bad_edid(connector, edid, 1);
-		goto out;
+		goto fail;
 	}
 
 	if (edid->extensions == 0)
-		return edid;
+		goto ok;
 
 	new = krealloc(edid, (edid->extensions + 1) * EDID_LENGTH, GFP_KERNEL);
 	if (!new)
-		goto out;
+		goto fail;
 	edid = new;
 
 	for (j = 1; j <= edid->extensions; j++) {
@@ -2150,7 +2150,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
 
 		if (!edid_block_status_valid(status, edid_block_tag(block))) {
 			if (status == EDID_BLOCK_READ_FAIL)
-				goto out;
+				goto fail;
 			invalid_blocks++;
 		}
 	}
@@ -2161,9 +2161,10 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
 		edid = edid_filter_invalid_blocks(edid, invalid_blocks);
 	}
 
+ok:
 	return edid;
 
-out:
+fail:
 	kfree(edid);
 	return NULL;
 }
-- 
2.30.2


  parent reply	other threads:[~2022-04-11  9:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11  9:47 [CI v2 00/12] drm/edid: low level EDID block read refactoring etc Jani Nikula
2022-04-11  9:47 ` [CI v2 01/12] drm/edid: convert edid_is_zero() to edid_block_is_zero() for blocks Jani Nikula
2022-04-11  9:47 ` [CI v2 02/12] drm/edid: have edid_block_check() detect blocks that are all zero Jani Nikula
2022-04-11  9:47 ` [CI v2 03/12] drm/edid: refactor EDID block status printing Jani Nikula
2022-04-11  9:47 ` [CI v2 04/12] drm/edid: add a helper to log dump an EDID block Jani Nikula
2022-04-11  9:47 ` [CI v2 05/12] drm/edid: pass struct edid to connector_bad_edid() Jani Nikula
2022-04-11  9:47 ` [CI v2 06/12] drm/edid: add typedef for block read function Jani Nikula
2022-04-11  9:47 ` [CI v2 07/12] drm/edid: abstract an EDID block read helper Jani Nikula
2022-04-11  9:47 ` [CI v2 08/12] drm/edid: use EDID block read helper in drm_do_get_edid() Jani Nikula
2022-04-11  9:47 ` [CI v2 09/12] drm/edid: convert extension block read to EDID block read helper Jani Nikula
2022-04-11  9:47 ` [CI v2 10/12] drm/edid: drop extra local var Jani Nikula
2022-04-11  9:47 ` Jani Nikula [this message]
2022-04-11  9:47 ` [CI v2 12/12] drm/edid: add EDID block count and size helpers Jani Nikula
2022-04-11 12:14   ` [Intel-gfx] " kernel test robot
2022-04-11 13:57     ` Jani Nikula
2022-04-11 12:24   ` kernel test robot
2022-04-11 13:54     ` Jani Nikula

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=1db13fe5a34c441558c2de11fec7218f22f9e43d.1649670305.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.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;
as well as URLs for NNTP newsgroup(s).