Re: [PATCH] regmap: define cleanup helper for regmap_field

From: Mark Brown

Date: Fri Feb 20 2026 - 10:44:09 EST


On Fri, Feb 20, 2026 at 04:36:46PM +0100, Sander Vanheule wrote:

> struct regmap_field *field = regmap_field_alloc(...);
> if (!field)
> return -ENOMEM;
>
> int err = regmap_field_write(...);
>
> regmap_field_free(field);
>
> return err;

That seems like a bit of an odd pattern, I'd expect the fields to live
for the lifetime of the driver rather than a function. OTOH if people
are doing that then sure.

> The included headers in regmap.h are not sorted, so I just included
> cleanup.h at the bottom of the list. Let me know if the headers should
> be sorted too, then I can make a preparatory patch.

Yes please.

Attachment: signature.asc
Description: PGP signature