[Intel-gfx] [PATCH v2] drm/i915/psr: Check for partial PSR dpcd reads
Tarun Vyas
tarun.vyas at intel.com
Wed May 30 00:58:17 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.
v2: Fix checkpatch warnings.
Signed-off-by: Tarun Vyas <tarun.vyas at intel.com>
---
drivers/gpu/drm/i915/intel_psr.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
index ebc483f06c6f..ed5591ed038c 100644
--- a/drivers/gpu/drm/i915/intel_psr.c
+++ b/drivers/gpu/drm/i915/intel_psr.c
@@ -234,8 +234,12 @@ 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