mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	David Airlie <airlied@linux.ie>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] drm/i915/dp: Use common error handling code in intel_dp_sink_crc_stop()
Date: Tue, 24 Oct 2017 16:00:11 +0200	[thread overview]
Message-ID: <1d3d0395-957a-2a87-3cb5-0d7355d04b65@users.sourceforge.net> (raw)
In-Reply-To: <668a4b56-091d-d4e7-2204-daaec6675e11@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Oct 2017 15:40:47 +0200

Adjust jump targets so that a specific error code assignment
will be in the implementation only at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/i915/intel_dp.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 342f1a1fa085..3dd514a77008 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3894,27 +3894,19 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp)
 	int count = 0;
 	int attempts = 10;
 
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
-		ret = -EIO;
-		goto out;
-	}
+	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0)
+		goto report_failure;
 
 	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-			       buf & ~DP_TEST_SINK_START) < 0) {
-		DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
-		ret = -EIO;
-		goto out;
-	}
+			       buf & ~DP_TEST_SINK_START) < 0)
+		goto report_failure;
 
 	do {
 		intel_wait_for_vblank(dev_priv, intel_crtc->pipe);
+		if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf)
+		    < 0)
+			goto e_io;
 
-		if (drm_dp_dpcd_readb(&intel_dp->aux,
-				      DP_TEST_SINK_MISC, &buf) < 0) {
-			ret = -EIO;
-			goto out;
-		}
 		count = buf & DP_TEST_COUNT_MASK;
 	} while (--attempts && count);
 
@@ -3923,9 +3915,15 @@ static int intel_dp_sink_crc_stop(struct intel_dp *intel_dp)
 		ret = -ETIMEDOUT;
 	}
 
- out:
+enable_ips:
 	hsw_enable_ips(intel_crtc);
 	return ret;
+
+report_failure:
+	DRM_DEBUG_KMS("Sink CRC couldn't be stopped properly\n");
+e_io:
+	ret = -EIO;
+	goto enable_ips;
 }
 
 static int intel_dp_sink_crc_start(struct intel_dp *intel_dp)
-- 
2.14.3

  parent reply	other threads:[~2017-10-24 14:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 13:58 [PATCH 0/2] GPU-DRM-i915-DP: Fine-tuning for two function implementations SF Markus Elfring
2017-10-24 13:59 ` [PATCH 1/2] drm/i915/dp: Delete an unnecessary goto statement in intel_dp_sink_crc() SF Markus Elfring
2017-10-24 14:00 ` SF Markus Elfring [this message]
2017-10-24 16:13   ` [PATCH 2/2] drm/i915/dp: Use common error handling code in intel_dp_sink_crc_stop() 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=1d3d0395-957a-2a87-3cb5-0d7355d04b65@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rodrigo.vivi@intel.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

Powered by JetHome