[Intel-gfx] [PATCH] drm/i915/psr: Check for partial PSR dpcd reads

Tarun Vyas tarun.vyas at intel.com
Tue May 29 20:28:05 UTC 2018


The dpcd read during psr_dpcd_init may not always return the
requested number of bytes. No known cases yet, but good to
put that check in place.

Signed-off-by: Tarun Vyas <tarun.vyas at intel.com>
---
 drivers/gpu/drm/i915/intel_psr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
index ebc483f06c6f..877ed763a12c 100644
--- a/drivers/gpu/drm/i915/intel_psr.c
+++ b/drivers/gpu/drm/i915/intel_psr.c
@@ -234,8 +234,11 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 	struct drm_i915_private *dev_priv =
 		to_i915(dp_to_dig_port(intel_dp)->base.base.dev);
 
-	drm_dp_dpcd_read(&intel_dp->aux, DP_PSR_SUPPORT, intel_dp->psr_dpcd,
-			 sizeof(intel_dp->psr_dpcd));
+	if (drm_dp_dpcd_read(&intel_dp->aux, DP_PSR_SUPPORT, intel_dp->psr_dpcd,
+			 sizeof(intel_dp->psr_dpcd)) != sizeof(intel_dp->psr_dpcd)) {
+		DRM_ERROR("PSR DPCD init failed \n");
+		return;
+	}
 
 	if (!intel_dp->psr_dpcd[0])
 		return;
-- 
2.13.5



More information about the Intel-gfx mailing list