Re: [PATCH v4 1/3] regcache: Move HW readback after cache initialisation

From: Mark Brown

Date: Mon Mar 02 2026 - 09:56:19 EST


On Mon, Mar 02, 2026 at 10:56:55AM +0100, Andy Shevchenko wrote:

> + /*
> + * Some devices such as PMICs don't have cache defaults,
> + * we cope with this by reading back the HW registers and
> + * crafting the cache defaults by hand.
> + */
> + ret = regcache_hw_init(map, count);
> + if (ret)
> + goto err_exit;
> +

We need to delete the free of reg_defaults from regcache_hw_init() when
it fails, the error handling for err_exit also frees that so we'd end up
with a double free. Which is awfully error prone and part of what
you're trying to fix here :/

Attachment: signature.asc
Description: PGP signature