From: "lihuisong (C)" <lihuisong@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <khtsai@google.com>, <hhhuuu@google.com>, <kees@kernel.org>,
<kexinsun@smail.nju.edu.cn>, <linux-kernel@vger.kernel.org>,
<linux-usb@vger.kernel.org>, <linuxarm@huawei.com>,
<zhanjie9@hisilicon.com>, <lihuisong@huawei.com>
Subject: Re: [PATCH v1 0/2] usb: gadget: udc: simplify lock holding using guards
Date: Mon, 20 Apr 2026 14:56:17 +0800 [thread overview]
Message-ID: <8309ac29-12bc-4e60-8054-18c6a5dedf01@huawei.com> (raw)
In-Reply-To: <2026042024-mystify-mountable-a406@gregkh>
On 4/20/2026 2:30 PM, Greg KH wrote:
> On Mon, Apr 20, 2026 at 02:21:01PM +0800, lihuisong (C) wrote:
>> On 4/20/2026 1:40 PM, Greg KH wrote:
>>> On Mon, Apr 20, 2026 at 11:57:20AM +0800, Huisong Li wrote:
>>>> Simplify udc_lock and connect_lock holding using guards in
>>>> gadget_bind_driver() and gadget_unbind_driver().
>>>>
>>>> Huisong Li (2):
>>>> usb: gadget: udc: simplify udc_lock holding using guards
>>>> usb: gadget: udc: simplify connect_lock holding using guards
>>>>
>>>> drivers/usb/gadget/udc/core.c | 77 ++++++++++++++++-------------------
>>>> 1 file changed, 35 insertions(+), 42 deletions(-)
>>> Only do this for new drivers, don't convert existing code that works
>>> just fine for no valid reason other than wanting to clean stuff up.
>>>
>>> Does this fix a bug?
>> Here not to fix a bug. But prepare for fixing a bug in link[1].
>> I found that there are many unlock of udc_lock in error path after that
>> patch.
>> So use the guard to simpliy them by the way.
>>
>> [1]https://patchwork.kernel.org/project/linux-usb/patch/20260420040223.1232745-1-lihuisong@huawei.com/
> So those patches must be applied in order? That was not obvious and I
> would have gotten them wrong :(
That patch in the link is not modified based on this series.
I originally thought that I would update that patch after this series is
merged (because there are not functional changes).
I will drop this series if accept the unlock on multiple error path.
>
> The policy of these guard usages is not to add them just to "clean up"
> the code, only use them to actually fix real bugs today, or in new code.
> Otherwise the churn in the kernel tree would be huge for no valid
> reason, and cause even more bugs with backports than this pattern causes
> today.
got it.
prev parent reply other threads:[~2026-04-20 6:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 3:57 Huisong Li
2026-04-20 3:57 ` [PATCH v1 1/2] usb: gadget: udc: simplify udc_lock " Huisong Li
2026-04-20 3:57 ` [PATCH v1 2/2] usb: gadget: udc: simplify connect_lock " Huisong Li
2026-04-20 5:40 ` [PATCH v1 0/2] usb: gadget: udc: simplify lock " Greg KH
2026-04-20 6:21 ` lihuisong (C)
2026-04-20 6:30 ` Greg KH
2026-04-20 6:56 ` lihuisong (C) [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=8309ac29-12bc-4e60-8054-18c6a5dedf01@huawei.com \
--to=lihuisong@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=hhhuuu@google.com \
--cc=kees@kernel.org \
--cc=kexinsun@smail.nju.edu.cn \
--cc=khtsai@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=zhanjie9@hisilicon.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
all inboxes | Powered by JetHome®