Re: [PATCH v3 2/2] usb: roles: serialize registered checks and unregister under sw->lock
From: Heikki Krogerus
Date: Fri Dec 04 2026 - 07:05:45 EST
On Fri, Dec 04, 2026 at 08:18:13PM +0900, Ilia Snezhkov wrote:
> Hi Heikki,
>
> On Fri, Dec 04, 2026 at 11:09:59AM +0100, Heikki Krogerus wrote:
> > Sorry, I failed to notice this before, but with guard(mutex) you can
> > avoid adding the label.
>
> Thanks for the review. While preparing v4, I noticed that Keisuke
> Tsukuda's earlier series fixing the same race was already applied to
> usb-testing as:
>
> 2480026d552e ("usb: dwc3: apple: unregister role switch before taking lock")
> 3fa9acc765d2 ("usb: roles: wait for callbacks on unregister")
>
> I am dropping this duplicate series. If you would still like a
> follow-up patch on top of usb-testing converting
> usb_role_switch_{set,get}_role() to guard(mutex) and documenting the
> lock-ordering contract on usb_role_switch_unregister(), I am happy to
> send one.
Ah, no worries, it's not a biggie.
--
heikki