From: Greg KH <gregkh@linuxfoundation.org>
To: "Yo-Jung (Leo) Lin" <0xff07@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
ricardo@marliere.net, skhan@linuxfoundation.org,
Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: vhci: manage mutex with cleanup helpers
Date: Tue, 13 Aug 2024 14:38:38 +0200 [thread overview]
Message-ID: <2024081309-lion-overlying-16a1@gregkh> (raw)
In-Reply-To: <20240813121829.6693-1-0xff07@gmail.com>
On Tue, Aug 13, 2024 at 08:18:28PM +0800, Yo-Jung (Leo) Lin wrote:
> Use macros in liunx/cleanup.h for automatic resource cleanup.
That says what you do, but not _why_ you want to do it.
>
> Signed-off-by: Yo-Jung (Leo) Lin <0xff07@gmail.com>
> ---
> drivers/bluetooth/hci_vhci.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
> index c4046f8f1985..70f0c28372ec 100644
> --- a/drivers/bluetooth/hci_vhci.c
> +++ b/drivers/bluetooth/hci_vhci.c
> @@ -19,6 +19,7 @@
> #include <linux/errno.h>
> #include <linux/sched.h>
> #include <linux/poll.h>
> +#include <linux/cleanup.h>
>
> #include <linux/skbuff.h>
> #include <linux/miscdevice.h>
> @@ -468,9 +469,9 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode)
> {
> int err;
>
> - mutex_lock(&data->open_mutex);
> - err = __vhci_create_device(data, opcode);
> - mutex_unlock(&data->open_mutex);
> + scoped_guard(mutex, &data->open_mutex) {
> + err = __vhci_create_device(data, opcode);
> + }
This isn't correct, but also, it's not needed at all :(
greg k-h
next prev parent reply other threads:[~2024-08-13 12:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 12:18 [PATCH] Bluetooth: vhci: manage mutex with cleanup helpers Yo-Jung (Leo) Lin
2024-08-13 12:38 ` Greg KH [this message]
2024-08-13 13:17 ` bluez.test.bot
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=2024081309-lion-overlying-16a1@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=0xff07@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=ricardo@marliere.net \
--cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.