* [PATCH] video: fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe()
@ 2023-06-04 15:42 Christophe JAILLET
2023-06-05 9:35 ` Helge Deller
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2023-06-04 15:42 UTC (permalink / raw)
To: Helge Deller, Imre Deak, Andrew Morton, Krzysztof Helt, Juha Yrjola
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-fbdev,
linux-omap, dri-devel
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@wanadoo.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] video: fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe()
2023-06-04 15:42 [PATCH] video: fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe() Christophe JAILLET
@ 2023-06-05 9:35 ` Helge Deller
0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2023-06-05 9:35 UTC (permalink / raw)
To: Christophe JAILLET, Imre Deak, Andrew Morton, Krzysztof Helt,
Juha Yrjola
Cc: linux-kernel, kernel-janitors, linux-fbdev, linux-omap, dri-devel
On 6/4/23 17:42, Christophe JAILLET wrote:
> 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@wanadoo.fr>
applied.
Thanks!
Helge
> ---
> 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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-05 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-04 15:42 [PATCH] video: fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe() Christophe JAILLET
2023-06-05 9:35 ` Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).