Re: [PATCH v2] auxdisplay: cfag12864bfb: Fix init cleanup and simplify error paths

From: Andy Shevchenko

Date: Wed Nov 18 2026 - 04:57:05 EST


On Wed, Nov 18, 2026 at 11:25 AM Haoxiang Li <haoxiang_li2024@xxxxxxx> wrote:
>
> If initialization fails after cfag12864b_enable() succeeds, LCD
> refreshing remains enabled. A subsequent attempt to load the
> framebuffer module can fail because refreshing is still marked
> as in use.
>
> Use platform_device_register_full() to simplify device registration
> and its error handling. Unregister the platform driver if device
> registration fails, and call cfag12864b_disable() on all failure
> paths after refreshing has been enabled.

...

> #include <linux/errno.h>

It doesn't use special Linux error codes, so this now can be dropped
(as asm/errno.h is implied by err.h that you added here).

> +#include <linux/err.h>

...

> + cfag12864bfb_device = platform_device_register_full(&pdevinfo);
> + if (IS_ERR(cfag12864bfb_device)) {
> + ret = PTR_ERR(cfag12864bfb_device);
> + goto err_unregister_driver;
> + }

ret = PTR_ERR_OR_ZERO(...);
if (ret)
goto ...

--
With Best Regards,
Andy Shevchenko