[PATCH v2 2/2] staging: fbtft: cleanup error handling in fbtft_framebuffer_alloc()

Andy Shevchenko andy.shevchenko at gmail.com
Sat Jun 28 19:58:20 UTC 2025


On Sat, Jun 28, 2025 at 7:59 AM Abdun Nihaal <abdun.nihaal at gmail.com> wrote:
>
> The error handling in fbtft_framebuffer_alloc() mixes managed allocation
> and plain allocation, and performs error handling in an order different
> from the order in fbtft_framebuffer_release().
>
> Fix them by moving vmem allocation closer to where it is used, and using
> plain kzalloc() for txbuf allocation.

...

> +       struct fbtft_par *par = info->par;
> +
> +       if (par->txbuf.len > 0)

Do we really need this check? If txbuf.buf is kept NULL (please, check
this), the kfree() is NULL-aware.

> +               kfree(par->txbuf.buf);
>         fb_deferred_io_cleanup(info);
>         vfree(info->screen_buffer);
>         framebuffer_release(info);


-- 
With Best Regards,
Andy Shevchenko


More information about the dri-devel mailing list