mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sander Vanheule <sander@svanheule.net>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regmap: define cleanup helper for regmap_field
Date: Fri, 20 Feb 2026 16:40:39 +0100	[thread overview]
Message-ID: <2868da8302e024a8c6f1f2240d64373a6bb1178a.camel@svanheule.net> (raw)
In-Reply-To: <20260220153646.494683-1-sander@svanheule.net>

Hi Mark,

On Fri, 2026-02-20 at 16:36 +0100, Sander Vanheule wrote:
> For temporary field allocation, the user has to perform manual cleanup,
> or rely on devm_regmap_field_alloc() to (eventually) clean up the
> allocated resources when an error occurs.
> 
> Add a cleanup helper that takes care of freeing the allocated
> regmap_field whenever it goes out of scope.
> 
> This can simplify this example:
> 
>     struct regmap_field *field = regmap_field_alloc(...);
>     if (!field)
>         return -ENOMEM;

The error handling should of course be:

        if (IS_ERR(field))
            return PTR_ERR(field);

I'll wait a bit for other feedback before I send a v2.

Best,
Sander

  reply	other threads:[~2026-02-20 15:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20 15:36 Sander Vanheule
2026-02-20 15:40 ` Sander Vanheule [this message]
2026-02-20 15:43 ` Mark Brown
2026-02-20 15:59   ` Sander Vanheule

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2868da8302e024a8c6f1f2240d64373a6bb1178a.camel@svanheule.net \
    --to=sander@svanheule.net \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®