diff options
author | Liu Ying <victor.liu@nxp.com> | 2018-11-28 16:27:39 +0800 |
---|---|---|
committer | Bryan O'Donoghue <bryan.odonoghue@linaro.org> | 2019-01-25 16:14:20 +0000 |
commit | 583e8307fec92b80417743e1f39ad6fea70b565b (patch) | |
tree | 42ebd0439c838f45f06364cb185fea87a5dfd752 | |
parent | 8aa5f47ece402b5a494da834cbfb22a179e18a91 (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.c | 4 |
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; } |