Re: [PATCH] usb: uhci: fix CONFIG_HAS_IOPORT guard in uhci-hcd.h
From: Alan Stern
Date: Fri Dec 04 2026 - 09:57:33 EST
On Fri, Dec 04, 2026 at 10:02:53AM +0800, Pengpeng Hou wrote:
> In a UHCI build supporting both PCI and non-PCI host controllers, the
> register-access helper tests HAS_IOPORT instead of CONFIG_HAS_IOPORT.
> This prevents selection of the port-I/O path even for a PCI controller
> with an I/O base.
>
> Use the actual configuration symbol, as the companion code already does.
> Keep MMIO for the non-PCI case.
>
> The issue was found by our static-analysis tool and manually reviewed.
>
> Fixes: dc54ce3e603b ("usb: uhci: handle HAS_IOPORT dependencies")
> Signed-off-by: Pengpeng Hou <hppiscas@xxxxxxx>
> ---
Reviewed-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
We rely so heavily on the compiler to warn about misspelled names, we
forget that the preprocessor doesn't always do it. Thanks for fixing
this.
Alan Stern
> The original patch was prepared with Gemini. Codex assisted with this
> review and revision (Assisted-by: gpt 5).
> Built uhci-hcd.o for ARM with Clang 18 and W=1 using the same mixed PCI
> and non-PCI configuration before and after the change. The preprocessed
> UHCI code gained the runtime PCI I/O-address check. No controller was
> exercised.
>
> drivers/usb/host/uhci-hcd.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
> index 4326d1f3ca768d02cf241f5c1275a840f504b711..f66bd22638dac06cacc684f5d2f7bcbf0fa5deb3 100644
> --- a/drivers/usb/host/uhci-hcd.h
> +++ b/drivers/usb/host/uhci-hcd.h
> @@ -548,7 +548,7 @@ static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
>
> #else
> /* Support non-PCI host controllers */
> -#if defined(CONFIG_USB_PCI) && defined(HAS_IOPORT)
> +#if defined(CONFIG_USB_PCI) && defined(CONFIG_HAS_IOPORT)
> /* Support PCI and non-PCI host controllers */
> #define uhci_has_pci_registers(u) ((u)->io_addr != 0)
> #else
>
> base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
>