From: Linus Walleij <linusw@kernel.org>
To: Ethan Tidmore <ethantidmore06@gmail.com>
Cc: joshua.henderson@microchip.com, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pinctrl: pinctrl-pic32: Fix resource leaks
Date: Fri, 27 Feb 2026 22:12:27 +0100 [thread overview]
Message-ID: <CAD++jLkHKBM7b5masVSmCfcdwXoxrS+fqySCp2xo7cu5aY0APg@mail.gmail.com> (raw)
In-Reply-To: <DGQ1PH7L50P5.1S6WZBTYH2SNR@gmail.com>
On Fri, Feb 27, 2026 at 10:01 PM Ethan Tidmore <ethantidmore06@gmail.com> wrote:
> On Thu Feb 26, 2026 at 4:37 PM CST, Linus Walleij wrote:
>
> > Can't you just use devm_clk_get_enabled() and let devres do this?
>
> I thought about that but wasn't sure because I saw:
>
> ret = gpiochip_add_data(&bank->gpio_chip, bank);
>
> Later in the function and knew that you're not really suppose to mix
> manual resource allocation and devres.
And there is a bunch of other devm_* stuff before it so it's
confusing isn't it? A mix however you put it.
In this case that is just because the gpiochip_add_data() happens
last in probe().
If you study the driver you see it does not have a .remove() function
and you can bet your life no-one is manually testing to remove it,
so all the devm_* stuff is just there for exititing a failed or deferred
probe.
When the probe reaches gpiochip_add_data() that is the last
thing that can fail, and if it fails there are just all the other
resources that need to be free:ed.
I'm all for changing that to devm_gpiochip_add_data()
for completion but semanically it won't matter unless someone
goes in and unbinds the driver in sysfs.
So use devm_clk_get_enabled() and optionally convert
to devm_gpiochip_add_data() as well.
Yours,
Linus Walleij
prev parent reply other threads:[~2026-02-27 21:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 20:28 Ethan Tidmore
2026-02-26 22:37 ` Linus Walleij
2026-02-27 21:01 ` Ethan Tidmore
2026-02-27 21:12 ` Linus Walleij [this message]
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=CAD++jLkHKBM7b5masVSmCfcdwXoxrS+fqySCp2xo7cu5aY0APg@mail.gmail.com \
--to=linusw@kernel.org \
--cc=ethantidmore06@gmail.com \
--cc=joshua.henderson@microchip.com \
--cc=linux-gpio@vger.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®