diff options
author | Fancy Fang <chen.fang@nxp.com> | 2019-06-03 10:45:59 +0800 |
---|---|---|
committer | Fancy Fang <chen.fang@nxp.com> | 2019-06-04 17:39:40 +0800 |
commit | f28801c464ac6d43893584af85bc348e66149e9d (patch) | |
tree | c61b658b8b52fd33538bdff06498c47a2e31f53b | |
parent | 46203bbd7c4d551ddf9cc84b4785a35f1139d357 (diff) |
MLK-21911 drm/bridge: sec-dsim: free 'pll_pms' to avoid memory leak
The 'pll_pms' data is allocated dynamically and it should be
freed after its usage is done explicitly, otherwise there is
a serious memory leak problem, since this data allocation
frequency is really high during video playback and graphic
cases running.
Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
-rw-r--r-- | drivers/gpu/drm/bridge/sec-dsim.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/bridge/sec-dsim.c b/drivers/gpu/drm/bridge/sec-dsim.c index 303122217833..879d17410ffd 100644 --- a/drivers/gpu/drm/bridge/sec-dsim.c +++ b/drivers/gpu/drm/bridge/sec-dsim.c @@ -1242,8 +1242,10 @@ struct dsim_pll_pms *sec_mipi_dsim_calc_pmsk(struct sec_mipi_dsim *dsim) } } - if (best_delta == ~0U) + if (best_delta == ~0U) { + devm_kfree(dev, pll_pms); return ERR_PTR(-EINVAL); + } pll_pms->p = best_p; pll_pms->m = best_m; @@ -1295,6 +1297,11 @@ int sec_mipi_dsim_check_pll_out(void *driver_private, PLLCTRL_SET_M(pmsk->m) | PLLCTRL_SET_S(pmsk->s); + /* free 'dsim_pll_pms' structure data which is + * allocated in 'sec_mipi_dsim_calc_pmsk()'. + */ + devm_kfree(dsim->dev, (void *)pmsk); + if (dsim->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) { hpar = sec_mipi_dsim_get_hblank_par(mode->name, mode->vrefresh, |