From: Greg KH <greg@kroah.com>
To: Lucas Tanure <tanure@linux.com>
Cc: kernelnewbies <kernelnewbies@kernelnewbies.org>,
"Billie Alsup \(balsup\)" <balsup@cisco.com>
Subject: Re: Simple mutex_destroy question
Date: Thu, 20 Nov 2025 14:43:58 +0100 [thread overview]
Message-ID: <2025112047-untimely-ducky-a78f@gregkh> (raw)
In-Reply-To: <CAJX_Q+2FgynWMfWdMURL2HbYv3iXFKZ7VgDbZyOUmc9MY_O4vQ@mail.gmail.com>
On Thu, Nov 20, 2025 at 10:27:06AM +0000, Lucas Tanure wrote:
> On Wed, Nov 19, 2025 at 4:27 PM Billie Alsup (balsup) <balsup@cisco.com> wrote:
> >
> > Since you're using devm_kzalloc, why not simply use devm_mutex_init and not worry about it? Then you can remove your explicit mutex_destroy call.
>
> I am developing drivers for Android 13 with kernel 5.10/5.4, which
> doesn't have devm_mutex_init.
No new devices should be shipping with Android13 as it is about to go
end-of-life, so please do NOT target these old kernels.
Do your development on the latest kernel release, get your changes
upstream, and then, if you need to apply them to a device-specific
kernel, backport it to that older kernel. That way is much simpler and
easier and will save you time.
> So, mutex_destroy is only needed for debugging locks? I see a few
> drivers don't have this call in their remove functions or in fail
> probe paths.
Then those are probably bugs that should be fixed up.
thanks,
greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
prev parent reply other threads:[~2025-11-20 13:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-23 16:47 Rust: how to implement file_operations for a misc device? Fabio
2025-09-24 10:27 ` Greg KH
2025-11-14 10:42 ` Simple mutex_destroy question Lucas Tanure
2025-11-19 10:08 ` Lucas Tanure
2025-11-19 13:08 ` Raka Gunarto
2025-11-19 16:27 ` Billie Alsup (balsup)
2025-11-20 10:27 ` Lucas Tanure
2025-11-20 13:43 ` Greg KH [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=2025112047-untimely-ducky-a78f@gregkh \
--to=greg@kroah.com \
--cc=balsup@cisco.com \
--cc=kernelnewbies@kernelnewbies.org \
--cc=tanure@linux.com \
/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