Commit 1c788f69 authored by Jani Nikula's avatar Jani Nikula

drm/edid: add single point of return to drm_do_get_edid()

This will be useful in the future. Use fail label for fail exit.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8e564e9415baa4dc9dc3127e4200b2618a8a3ba0.1649685475.git.jani.nikula@intel.com
parent b3eb97b6
......@@ -2106,7 +2106,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
edid = drm_get_override_edid(connector);
if (edid)
return edid;
goto ok;
edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
if (!edid)
......@@ -2117,7 +2117,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
edid_block_status_print(status, edid, 0);
if (status == EDID_BLOCK_READ_FAIL)
goto out;
goto fail;
/* FIXME: Clarify what a corrupt EDID actually means. */
if (status == EDID_BLOCK_OK || status == EDID_BLOCK_VERSION)
......@@ -2130,15 +2130,15 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
connector->null_edid_counter++;
connector_bad_edid(connector, edid, 1);
goto out;
goto fail;
}
if (edid->extensions == 0)
return edid;
goto ok;
new = krealloc(edid, (edid->extensions + 1) * EDID_LENGTH, GFP_KERNEL);
if (!new)
goto out;
goto fail;
edid = new;
for (j = 1; j <= edid->extensions; j++) {
......@@ -2150,7 +2150,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
if (!edid_block_status_valid(status, edid_block_tag(block))) {
if (status == EDID_BLOCK_READ_FAIL)
goto out;
goto fail;
invalid_blocks++;
}
}
......@@ -2161,9 +2161,10 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
edid = edid_filter_invalid_blocks(edid, invalid_blocks);
}
ok:
return edid;
out:
fail:
kfree(edid);
return NULL;
}
......
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