[PATCH 14/14] fbdev: sm501fb: fix potential memory leak in sm501fb_probe()

From: Abdun Nihaal

Date: Thu May 14 2026 - 04:30:17 EST


The memory allocated for info->edid_data in sm501fb_probe() when
CONFIG_OF is defined is not freed in the subsequent error paths.
Fix that by freeing it in the error path if CONFIG_OF is defined.

Fixes: 4295f9bf74a8 ("video, sm501: add OF binding to support SM501")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Abdun Nihaal <nihaal@xxxxxxxxxxxxxx>
---
drivers/video/fbdev/sm501fb.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index fee4b9f84592..1ee7842517b8 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -2048,6 +2048,9 @@ static int sm501fb_probe(struct platform_device *pdev)
framebuffer_release(info->fb[HEAD_CRT]);

err_alloc:
+#if defined(CONFIG_OF)
+ kfree(info->edid_data);
+#endif
kfree(info);

return ret;

--
2.43.0