diff mbox

[v2,04/18] DRM/KMS/EDID: Don't fail when failing to allocate memory for EDID extensions.

Message ID 1353579788-30637-5-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
When we fail to allocate space for EDID extensions we should just
warn, fix up the EDID block count and return the base block instead
of failing.

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 043ba42..a952cfe 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -347,8 +347,11 @@  drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
 		return block;
 
 	new = krealloc(block, (block[EDID_EXTENSION_FLAG_OFFSET] + 1) * EDID_LENGTH, GFP_KERNEL);
-	if (!new)
-		goto out;
+	if (!new) {
+		dev_warn(connector->dev->dev, "%s: cannot allocate memory for %d EDID blocks: truncating.\n",
+			 drm_get_connector_name(connector), block[EDID_EXTENSION_FLAG_OFFSET] + 1);
+		goto done_fix_extension_count;
+	}
 	block = new;
 
 	for (j = 1; j <= block[EDID_EXTENSION_FLAG_OFFSET]; j++) {