[PATCH] auxdisplay: hd44780: Fix an API misuse in hd44780_probe()

Haoxiang Li posted 1 patch 11 months, 2 weeks ago
drivers/auxdisplay/hd44780.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] auxdisplay: hd44780: Fix an API misuse in hd44780_probe()
Posted by Haoxiang Li 11 months, 2 weeks ago
Variable "lcd" allocated by charlcd_alloc() should be
released by charlcd_free(). The following patch changed
kfree(lcd) to charlcd_free(lcd) to fix an API misuse.

Fixes: 718e05ed92ec ("auxdisplay: Introduce hd44780_common.[ch]")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
 drivers/auxdisplay/hd44780.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/auxdisplay/hd44780.c b/drivers/auxdisplay/hd44780.c
index 0526f0d90a79..a1729196bc82 100644
--- a/drivers/auxdisplay/hd44780.c
+++ b/drivers/auxdisplay/hd44780.c
@@ -313,7 +313,7 @@ static int hd44780_probe(struct platform_device *pdev)
 fail3:
 	kfree(hd);
 fail2:
-	kfree(lcd);
+	charlcd_free(lcd);
 fail1:
 	kfree(hdc);
 	return ret;
-- 
2.25.1
Re: [PATCH] auxdisplay: hd44780: Fix an API misuse in hd44780_probe()
Posted by Geert Uytterhoeven 11 months, 2 weeks ago
Hi Haoxiang,

On Mon, 24 Feb 2025 at 10:39, Haoxiang Li <haoxiang_li2024@163.com> wrote:
> Variable "lcd" allocated by charlcd_alloc() should be
> released by charlcd_free(). The following patch changed
> kfree(lcd) to charlcd_free(lcd) to fix an API misuse.
>
> Fixes: 718e05ed92ec ("auxdisplay: Introduce hd44780_common.[ch]")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>

Thanks for your patch!

> --- a/drivers/auxdisplay/hd44780.c
> +++ b/drivers/auxdisplay/hd44780.c
> @@ -313,7 +313,7 @@ static int hd44780_probe(struct platform_device *pdev)
>  fail3:
>         kfree(hd);
>  fail2:
> -       kfree(lcd);
> +       charlcd_free(lcd);
>  fail1:
>         kfree(hdc);
>         return ret;

LGTM, but please make a similar change to hd44780_remove().

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds