* [PATCH] usb: ohci: use IS_REACHABLE(CONFIG_MFD_SM501) for SM501 glue
@ 2026-12-04 2:28 Pengpeng Hou
2026-12-04 2:41 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-12-04 2:28 UTC (permalink / raw)
To: Alan Stern, Greg Kroah-Hartman; +Cc: linux-usb, Pengpeng Hou, Lee Jones, mfd
The SM501 MFD can create an OHCI platform device even when the MFD and
OHCI drivers are modules. In that case the OHCI module currently omits
the matching SM501 glue.
Check reachability when including the glue; retain the built-in/module
linkage restriction.
The issue was found by our static-analysis tool and manually reviewed.
Fixes: f54aab6ebcec ("usb: ohci-sm501 driver")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
The original patch was prepared with Gemini. Codex assisted with this
review and revision (Assisted-by: gpt 5).
Built ohci-hcd.o on x86-64 with GCC 11.4 and W=1 (CONFIG_USB_OHCI_HCD=m,
CONFIG_MFD_SM501=m). No runtime or hardware test was performed.
drivers/usb/host/ohci-hcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 129468b1efc25e8e9881ee09b9ef52cd371aedd8..acfc83fc45d8248bbf0cbb9ebce5dbcaec61afff 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1268,7 +1268,7 @@ MODULE_LICENSE ("GPL");
#define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver
#endif
-#ifdef CONFIG_MFD_SM501
+#if IS_REACHABLE(CONFIG_MFD_SM501)
#include "ohci-sm501.c"
#define SM501_OHCI_DRIVER ohci_hcd_sm501_driver
#endif
base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] usb: ohci: use IS_REACHABLE(CONFIG_MFD_SM501) for SM501 glue
2026-12-04 2:28 [PATCH] usb: ohci: use IS_REACHABLE(CONFIG_MFD_SM501) for SM501 glue Pengpeng Hou
@ 2026-12-04 2:41 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-04 2:41 UTC (permalink / raw)
To: Pengpeng Hou; +Cc: linux-usb, mfd, lee
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] usb: ohci: IS_REACHABLE(CONFIG_MFD_SM501) couples ohci-hcd.ko
to sm501.ko
--
commit bcdfc91876aa48e5c117d4d8258a5503ecae195e
Author: Pengpeng Hou <hppiscas@163.com>
usb: ohci: use IS_REACHABLE(CONFIG_MFD_SM501) for SM501 glue
This commit changes the preprocessor guard around ohci-sm501.c in
drivers/usb/host/ohci-hcd.c from #ifdef CONFIG_MFD_SM501 to
#if IS_REACHABLE(CONFIG_MFD_SM501) so the SM501 glue is included when
both ohci-hcd and sm501 are built as modules.
> diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
> index 129468b1efc25..acfc83fc45d82 100644
> --- a/drivers/usb/host/ohci-hcd.c
> +++ b/drivers/usb/host/ohci-hcd.c
> @@ -1268,7 +1268,7 @@ MODULE_LICENSE ("GPL");
> #define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver
> #endif
>
> -#ifdef CONFIG_MFD_SM501
> +#if IS_REACHABLE(CONFIG_MFD_SM501)
> #include "ohci-sm501.c"
> #define SM501_OHCI_DRIVER ohci_hcd_sm501_driver
> #endif
[Severity: High]
Does this introduce a hard module dependency from ohci-hcd.ko onto
sm501.ko?
When CONFIG_USB_OHCI_HCD=m and CONFIG_MFD_SM501=m, embedding ohci-sm501.c
into ohci-hcd.ko pulls in calls to sm501_unit_power() and
sm501_modify_reg(), which are exported by sm501.ko.
Because standalone OHCI drivers such as ohci-pci.ko depend on ohci-hcd.ko
via ohci_init_driver(), loading any modular OHCI driver now forces
sm501.ko to load on systems without SM501 hardware, and fails in minimal
initramfs images or split-package kernels where sm501.ko is absent.
This also leaves CONFIG_USB_OHCI_HCD=y with CONFIG_MFD_SM501=m
unsupported, since IS_REACHABLE() evaluates to false when ohci-hcd is
built in.
Splitting ohci-sm501.c into a standalone platform driver module using
ohci_init_driver() and MODULE_ALIAS("platform:sm501-usb") would avoid
coupling ohci-hcd.ko to sm501.ko while supporting both modular and
built-in ohci-hcd configurations.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179635133288.74470.3309482874196875020@163.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-04 2:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 2:28 [PATCH] usb: ohci: use IS_REACHABLE(CONFIG_MFD_SM501) for SM501 glue Pengpeng Hou
2026-12-04 2:41 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox