]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: make sink_crc return -EIO on aux read/write failure
authorRodrigo Vivi <rodrigo.vivi@intel.com>
Wed, 1 Oct 2014 14:32:37 +0000 (07:32 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 2 Oct 2014 07:46:59 +0000 (09:46 +0200)
Even though it's unliky, we should check each aux transaction not just
the first one. Also

commit ce31d9f4fc05964f6c0dd3a8661dc1a1d843a1e2
Author: Rodrigo Vivi <rodrigo.vivi@intel.com>
Date:   Mon Sep 29 18:29:52 2014 -0400

    drm/i915: preserve other DP_TEST_SINK bits.

added a new aux transaction before the one which was checked. Fix
this.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Todd Previte <tprevite@gmail.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_dp.c

index b2aedcf8c8ecdd08b0dca4f50b32a94b8331a12c..50bcd09f53be4cd68a5ef94551f506403ed3d47f 100644 (file)
@@ -3875,16 +3875,21 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)
        if (!(buf & DP_TEST_CRC_SUPPORTED))
                return -ENOTTY;
 
-       drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf);
+       if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0)
+               return -EIO;
+
        if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
                                buf | DP_TEST_SINK_START) < 0)
                return -EIO;
 
-       drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf);
+       if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf) < 0)
+               return -EIO;
        test_crc_count = buf & DP_TEST_COUNT_MASK;
 
        do {
-               drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK_MISC, &buf);
+               if (drm_dp_dpcd_readb(&intel_dp->aux,
+                                     DP_TEST_SINK_MISC, &buf) < 0)
+                       return -EIO;
                intel_wait_for_vblank(dev, intel_crtc->pipe);
        } while (--attempts && (buf & DP_TEST_COUNT_MASK) == test_crc_count);
 
@@ -3896,9 +3901,11 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)
        if (drm_dp_dpcd_read(&intel_dp->aux, DP_TEST_CRC_R_CR, crc, 6) < 0)
                return -EIO;
 
-       drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf);
-       drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
-                       buf & ~DP_TEST_SINK_START);
+       if (drm_dp_dpcd_readb(&intel_dp->aux, DP_TEST_SINK, &buf) < 0)
+               return -EIO;
+       if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TEST_SINK,
+                              buf & ~DP_TEST_SINK_START) < 0)
+               return -EIO;
 
        return 0;
 }