Re: [PATCH] usb: host: Fix companion leak in usb_enable_intel_xhci_ports()
From: Wentao Liang
Date: Sat Nov 07 2026 - 14:04:57 EST
Hi Mathias,
Sorry for the very late reply.
You are right: pci_dev_put() should only be called when the loop is left
with ehci_found set, so it belongs after the !ehci_found check or in the
match branch before the break. My version released the reference
unconditionally after the loop.
While checking mainline before preparing a v2, I found that the same fix
is already merged:
e93731c29f74 ("USB: pci-quirks: Release EHCI device reference")
It calls pci_dev_put(companion) in the match branch before the break,
which is equivalent to your suggestion. The patch is therefore redundant,
so please drop it. I will not send a v2, since adding the put again on
top of the merged fix would release the reference twice.
Thanks,
Wentao