[PATCH] drm/amd/display: fix return value of dm_dp_aux_transfer()

Shirish S shirish.s at amd.com
Tue Apr 17 06:03:59 UTC 2018


Currently the dm_dp_aux_transfer() does not parse
the return value of dal_ddc_service_read_dpcd_data(), which also
has a failure case.
This patch captures the same and ensures the i2c operation status is
sent provided appropriately to the callers to it.

Signed-off-by: Shirish S <shirish.s at amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 782491e..7ac124d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -115,7 +115,11 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
 				msg->address,
 				msg->buffer,
 				msg->size);
-		return read_bytes;
+		if (read_bytes != msg->size &&
+		    read_bytes >= DDC_RESULT_FAILED_OPERATION)
+			return -EIO;
+		else
+			return read_bytes;
 	case DP_AUX_I2C_WRITE:
 		res = dal_ddc_service_write_dpcd_data(
 				TO_DM_AUX(aux)->ddc_service,
-- 
2.7.4



More information about the amd-gfx mailing list