The cea[2] is equal to the real value minus one in some sink edid,
found on a Konka LCD TV. the last data block offset plus the payload
length is equal to cea[2]. The end value need to plus one under this
scene.
Change-Id: I41b477559023ccd1cc4a5450dd9d35bed095f147
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
*end = 127;
if (*end < 4 || *end > 127)
return -ERANGE;
+
+ /*
+ * XXX: cea[2] is equal to the real value minus one in some sink edid.
+ */
+ if (*end != 4) {
+ int i;
+
+ i = *start;
+ while (i < (*end) &&
+ i + cea_db_payload_len(&(cea)[i]) < (*end))
+ i += cea_db_payload_len(&(cea)[i]) + 1;
+
+ if (cea_db_payload_len(&(cea)[i]) &&
+ i + cea_db_payload_len(&(cea)[i]) == (*end))
+ (*end)++;
+ }
+
return 0;
}