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

Commit c5647af5 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mdss: dsi: Resolving memory leak in parse dsi commands"

parents d6bd6139 baf9b4b8
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -448,7 +448,7 @@ static int mdss_dsi_parse_dcs_cmds(struct device_node *np,
		if (dchdr->dlen > len) {
			pr_err("%s: dtsi cmd=%x error, len=%d",
				__func__, dchdr->dtype, dchdr->dlen);
			return -ENOMEM;
			goto exit_free;
		}
		bp += sizeof(*dchdr);
		len -= sizeof(*dchdr);
@@ -460,14 +460,13 @@ static int mdss_dsi_parse_dcs_cmds(struct device_node *np,
	if (len != 0) {
		pr_err("%s: dcs_cmd=%x len=%d error!",
				__func__, buf[0], blen);
		kfree(buf);
		return -ENOMEM;
		goto exit_free;
	}

	pcmds->cmds = kzalloc(cnt * sizeof(struct dsi_cmd_desc),
						GFP_KERNEL);
	if (!pcmds->cmds)
		return -ENOMEM;
		goto exit_free;

	pcmds->cmd_cnt = cnt;
	pcmds->buf = buf;
@@ -495,6 +494,10 @@ static int mdss_dsi_parse_dcs_cmds(struct device_node *np,
		pcmds->buf[0], pcmds->blen, pcmds->cmd_cnt, pcmds->link_state);

	return 0;

exit_free:
	kfree(buf);
	return -ENOMEM;
}