Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18b469da authored by Ray Zhang's avatar Ray Zhang Committed by Nirmal Abraham
Browse files

drm/msm/dp: reallocate EDID buffer when needed



In certain cases the pre-allocated EDID buffer is not
enough for incoming EDID data, so reallocate the
buffer according to the actual EDID data size.

CRs-Fixed: 2291153
Change-Id: I9960758dc405757c8ca07e2cbdcdcdad91a9b045
Signed-off-by: default avatarRay Zhang <rayz@codeaurora.org>
parent 74195788
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -122,10 +122,26 @@ static ssize_t dp_debug_write_edid(struct file *file,
		goto bail;

	if (edid_size != debug->edid_size) {
		pr_debug("clearing debug edid\n");
		pr_debug("realloc debug edid\n");

		if (debug->edid) {
			devm_kfree(debug->dev, debug->edid);

			debug->edid = devm_kzalloc(debug->dev,
						edid_size, GFP_KERNEL);
			if (!debug->edid) {
				rc = -ENOMEM;
				goto bail;
			}

			debug->edid_size = edid_size;

			debug->aux->set_sim_mode(debug->aux,
					debug->dp_debug.sim_mode,
					debug->edid, debug->dpcd);
		}
	}

	while (edid_size--) {
		char t[3];
		int d;