diff mbox

[v2,03/18] DRM/KMS/EDID: Return Base EDID block if reading EEDID Blocks fails (v2)

Message ID 1353579788-30637-4-git-send-email-eich@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Egbert Eich Nov. 22, 2012, 10:22 a.m. UTC
If I2C readout fails for an extension block but we have read a
valid base block, don't fail completely but at least return the
base block.

v2: Make goto target names more telling.

Signed-off-by: Egbert Eich <eich@suse.com>
---
 drivers/gpu/drm/drm_edid.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 9e64069..043ba42 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -355,8 +355,10 @@  drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
 		for (i = 0; i < 4; i++) {
 			if (drm_do_probe_ddc_edid(adapter,
 				  block + (valid_extensions + 1) * EDID_LENGTH,
-				  j, EDID_LENGTH))
-				goto out;
+				  j, EDID_LENGTH)) {
+				valid_extensions = 0;
+				goto done_fix_extension_count;
+			}
 			if (drm_edid_block_valid(block + (valid_extensions + 1) * EDID_LENGTH, j, print_bad_edid)) {
 				valid_extensions++;
 				break;
@@ -368,6 +370,7 @@  drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
 			 drm_get_connector_name(connector), j);
 	}
 
+done_fix_extension_count:
 	if (valid_extensions != block[EDID_EXTENSION_FLAG_OFFSET]) {
 		block[EDID_CHECKSUM_OFFSET] += block[EDID_EXTENSION_FLAG_OFFSET] - valid_extensions;
 		block[EDID_EXTENSION_FLAG_OFFSET] = valid_extensions;