Commit 8f62142e authored by Thierry Reding's avatar Thierry Reding

drm/tegra: dc: Properly cleanup overlay planes

The first overlay plane can leak if initialization of the second overlay
plane fails. Fix this by properly destroying the first overlay plane on
error.
Suggested-by: default avatarDmitry Osipenko <digetx@gmail.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 89f65018
...@@ -937,20 +937,24 @@ static struct drm_plane *tegra_dc_add_shared_planes(struct drm_device *drm, ...@@ -937,20 +937,24 @@ static struct drm_plane *tegra_dc_add_shared_planes(struct drm_device *drm,
static struct drm_plane *tegra_dc_add_planes(struct drm_device *drm, static struct drm_plane *tegra_dc_add_planes(struct drm_device *drm,
struct tegra_dc *dc) struct tegra_dc *dc)
{ {
struct drm_plane *plane, *primary; struct drm_plane *planes[2], *primary;
unsigned int i; unsigned int i;
int err;
primary = tegra_primary_plane_create(drm, dc); primary = tegra_primary_plane_create(drm, dc);
if (IS_ERR(primary)) if (IS_ERR(primary))
return primary; return primary;
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
plane = tegra_dc_overlay_plane_create(drm, dc, 1 + i); planes[i] = tegra_dc_overlay_plane_create(drm, dc, 1 + i);
if (IS_ERR(plane)) { if (IS_ERR(planes[i])) {
/* XXX tegra_plane_destroy() */ err = PTR_ERR(planes[i]);
drm_plane_cleanup(primary);
kfree(primary); while (i--)
return plane; tegra_plane_funcs.destroy(planes[i]);
tegra_plane_funcs.destroy(primary);
return ERR_PTR(err);
} }
} }
......
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