[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <f17221571f619c0829db56354f2b74d22f6702a7.1685893329.git.christophe.jaillet@wanadoo.fr>
Date: Sun, 4 Jun 2023 17:42:28 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Helge Deller <deller@....de>, Imre Deak <imre.deak@...ia.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Krzysztof Helt <krzysztof.h1@...pl>,
Juha Yrjola <juha.yrjola@...idboot.com>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-fbdev@...r.kernel.org, linux-omap@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Subject: [PATCH] video: fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe()
If 'mipid_detect()' fails, we must free 'md' to avoid a memory leak.
Fixes: 66d2f99d0bb5 ("omapfb: add support for MIPI-DCS compatible LCDs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
drivers/video/fbdev/omap/lcd_mipid.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/omap/lcd_mipid.c b/drivers/video/fbdev/omap/lcd_mipid.c
index e4a7f0b824ff..a0fc4570403b 100644
--- a/drivers/video/fbdev/omap/lcd_mipid.c
+++ b/drivers/video/fbdev/omap/lcd_mipid.c
@@ -571,11 +571,15 @@ static int mipid_spi_probe(struct spi_device *spi)
r = mipid_detect(md);
if (r < 0)
- return r;
+ goto free_md;
omapfb_register_panel(&md->panel);
return 0;
+
+free_md:
+ kfree(md);
+ return r;
}
static void mipid_spi_remove(struct spi_device *spi)
--
2.34.1
Powered by blists - more mailing lists