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

Commit 85ef3fe9 authored by Lloyd Atkinson's avatar Lloyd Atkinson Committed by Narendra Muppalla
Browse files

drm/msm/sde: remove static allocation of mdp_top hw block



Remove singleton behavior from mdp_top hardware block since it
is no longer necessary. The resource manager now manages the
lifecycle of the mdp_top. This fixes an issue where the static
mdp_top would point to freed memory.

Change-Id: Ie860fd65ac2efa28ed0f3d9014bb45b0cc6aed5e
Signed-off-by: default avatarLloyd Atkinson <latkinso@codeaurora.org>
parent 8f727920
Loading
Loading
Loading
Loading
+10 −13
Original line number Diff line number Diff line
@@ -141,34 +141,31 @@ struct sde_hw_mdp *sde_hw_mdptop_init(enum sde_mdp idx,
		void __iomem *addr,
		const struct sde_mdss_cfg *m)
{
	static struct sde_hw_mdp *c;
	struct sde_hw_mdp *mdp;
	const struct sde_mdp_cfg *cfg;

	/* mdp top is singleton */
	if (c)
		return c;

	c = kzalloc(sizeof(*c), GFP_KERNEL);
	if (!c)
	mdp = kzalloc(sizeof(*mdp), GFP_KERNEL);
	if (!mdp)
		return ERR_PTR(-ENOMEM);

	cfg = _top_offset(idx, m, addr, &c->hw);
	cfg = _top_offset(idx, m, addr, &mdp->hw);
	if (IS_ERR_OR_NULL(cfg)) {
		kfree(c);
		kfree(mdp);
		return ERR_PTR(-EINVAL);
	}

	/*
	 * Assign ops
	 */
	c->idx = idx;
	c->cap = cfg;
	_setup_mdp_ops(&c->ops, c->cap->features);
	mdp->idx = idx;
	mdp->cap = cfg;
	_setup_mdp_ops(&mdp->ops, mdp->cap->features);

	/*
	 * Perform any default initialization for the intf
	 */
	return c;

	return mdp;
}

void sde_hw_mdp_destroy(struct sde_hw_mdp *mdp)