staging: fbtft: core: fix potential memory leak in fbtft_probe_common()
Subsystems (3)
PATCH v2 1/1 staging: fbtft: core: fix potential memory leak in fbtft_probe_common()
From: Jianglei Nie <[email protected]>
fbtft_probe_common() allocates a memory chunk for "info" with fbtft_framebuffer_alloc(). When "display->buswidth == 0" is true, the function returns without releasing the "info", which will lead to a memory leak.
Fix it by calling fbtft_framebuffer_release() when "display->buswidth == 0" is true.
Fixes c296d5f9957c ("staging: fbtft: core support")
Signed-off-by Jianglei Nie <[email protected]>
Signed-off-by Andy Shevchenko <[email protected]>
---
v2: fixed in accordance with Andy's review
drivers/staging/fbtft/fbtft-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/fbtft/fbtft-core.c +2 -2
@@ -1171,8 +1171,8 @@ int fbtft_probe_common(struct fbtft_display *display, par->pdev = pdev;if (display->buswidth ==0 ) { -dev_err (dev,"buswidth is not set\n" ); -return -EINVAL ; + ret =dev_err_probe (dev, -EINVAL ,"buswidth is not set\n" ); + goto out_release; }/* write register functions */
Signature · 1 line
2.50.1
Looks good to me.
Acked-by Abdun Nihaal <[email protected]>