summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu Ying <victor.liu@nxp.com>2018-11-28 16:27:39 +0800
committerBryan O'Donoghue <bryan.odonoghue@linaro.org>2019-05-01 17:43:28 +0100
commit0c29cc356a65cca11e1bc33cad5934d1bd01a738 (patch)
treef7e2602ab132d9cc715407645468a0c6d555ab3e
parent4a86befd6f266d0fbfa5d2837c54e907d94c3c04 (diff)
MLK-16302-1 drm/imx: dpu: plane: Free dpu_plane when bailout from dpu_plane_init
The dpu_plane is allocated with kzalloc() in dpu_plane_init(). In case, dpu_plane_init() fails after that allocation, the bailout path should free the dpu_plane, otherwise, there will be memory leakage. Signed-off-by: Liu Ying <victor.liu@nxp.com> (cherry picked from commit 99cb80f855aafbe524519db635c3d03bd4cc8d85)
-rw-r--r--drivers/gpu/drm/imx/dpu/dpu-plane.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/imx/dpu/dpu-plane.c b/drivers/gpu/drm/imx/dpu/dpu-plane.c
index 0a62b003d473..c14f9db57c7e 100644
--- a/drivers/gpu/drm/imx/dpu/dpu-plane.c
+++ b/drivers/gpu/drm/imx/dpu/dpu-plane.c
@@ -988,8 +988,10 @@ struct dpu_plane *dpu_plane_init(struct drm_device *drm,
ret = -EINVAL;
}
- if (ret)
+ if (ret) {
+ kfree(dpu_plane);
return ERR_PTR(ret);
+ }
return dpu_plane;
}