Commit ea0aa608 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/edid: Move validate_displayid() drm_find_displayid_extension()

Instead of everyone having to call validate_displayid() let's just
have drm_find_displayid_extension() do it for them.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200313162054.16009-6-ville.syrjala@linux.intel.comReviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 23b03867
...@@ -3216,6 +3216,7 @@ static u8 *drm_find_displayid_extension(const struct edid *edid, ...@@ -3216,6 +3216,7 @@ static u8 *drm_find_displayid_extension(const struct edid *edid,
int *length, int *idx) int *length, int *idx)
{ {
u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT); u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT);
int ret;
if (!displayid) if (!displayid)
return NULL; return NULL;
...@@ -3223,12 +3224,15 @@ static u8 *drm_find_displayid_extension(const struct edid *edid, ...@@ -3223,12 +3224,15 @@ static u8 *drm_find_displayid_extension(const struct edid *edid,
*length = EDID_LENGTH; *length = EDID_LENGTH;
*idx = 1; *idx = 1;
ret = validate_displayid(displayid, *length, *idx);
if (ret)
return NULL;
return displayid; return displayid;
} }
static u8 *drm_find_cea_extension(const struct edid *edid) static u8 *drm_find_cea_extension(const struct edid *edid)
{ {
int ret;
int length, idx; int length, idx;
struct displayid_block *block; struct displayid_block *block;
u8 *cea; u8 *cea;
...@@ -3244,10 +3248,6 @@ static u8 *drm_find_cea_extension(const struct edid *edid) ...@@ -3244,10 +3248,6 @@ static u8 *drm_find_cea_extension(const struct edid *edid)
if (!displayid) if (!displayid)
return NULL; return NULL;
ret = validate_displayid(displayid, length, idx);
if (ret)
return NULL;
idx += sizeof(struct displayid_hdr); idx += sizeof(struct displayid_hdr);
for_each_displayid_db(displayid, block, idx, length) { for_each_displayid_db(displayid, block, idx, length) {
if (block->tag == DATA_BLOCK_CTA) { if (block->tag == DATA_BLOCK_CTA) {
...@@ -5188,7 +5188,6 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, ...@@ -5188,7 +5188,6 @@ static int add_displayid_detailed_modes(struct drm_connector *connector,
struct edid *edid) struct edid *edid)
{ {
u8 *displayid; u8 *displayid;
int ret;
int length, idx; int length, idx;
struct displayid_block *block; struct displayid_block *block;
int num_modes = 0; int num_modes = 0;
...@@ -5197,10 +5196,6 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, ...@@ -5197,10 +5196,6 @@ static int add_displayid_detailed_modes(struct drm_connector *connector,
if (!displayid) if (!displayid)
return 0; return 0;
ret = validate_displayid(displayid, length, idx);
if (ret)
return 0;
idx += sizeof(struct displayid_hdr); idx += sizeof(struct displayid_hdr);
for_each_displayid_db(displayid, block, idx, length) { for_each_displayid_db(displayid, block, idx, length) {
switch (block->tag) { switch (block->tag) {
...@@ -5848,10 +5843,6 @@ static int drm_parse_display_id(struct drm_connector *connector, ...@@ -5848,10 +5843,6 @@ static int drm_parse_display_id(struct drm_connector *connector,
struct displayid_block *block; struct displayid_block *block;
int ret; int ret;
ret = validate_displayid(displayid, length, idx);
if (ret)
return ret;
idx += sizeof(struct displayid_hdr); idx += sizeof(struct displayid_hdr);
for_each_displayid_db(displayid, block, idx, length) { for_each_displayid_db(displayid, block, idx, length) {
DRM_DEBUG_KMS("block id 0x%x, rev %d, len %d\n", DRM_DEBUG_KMS("block id 0x%x, rev %d, len %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment