Re: [PATCH] regcache: Do not overwrite error code when finalizing cache after error

From: Andy Shevchenko

Date: Wed Jun 17 2026 - 02:57:56 EST


On Tue, Jun 16, 2026 at 01:44:29PM +0200, Francesco Lavra wrote:
> During regcache initialization, if an error occurs in the
> cache_ops->populate callback, and if cache operations include an exit
> callback, the error code from populate() is overwritten with the return
> value from exit(). This hides the error condition from the caller of
> regcache_init(), and can cause NULL pointer dereferences when the regcache
> is later accessed.

Ah, good catch!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

--
With Best Regards,
Andy Shevchenko