All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: avoid renesas_usb_fw.mem when it's unusable
@ 2021-07-02  5:47 Greg Thelen
  2021-07-02  5:56 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Thelen @ 2021-07-02  5:47 UTC (permalink / raw)
  To: Vinod Koul, Mathias Nyman, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Greg Thelen

Commit a66d21d7dba8 ("usb: xhci: Add support for Renesas controller with
memory") added renesas_usb_fw.mem firmware reference to xhci-pci.  Thus
modinfo indicates xhci-pci.ko has "firmware: renesas_usb_fw.mem".  But
the firmware is only actually used with CONFIG_USB_XHCI_PCI_RENESAS.  An
unusable firmware reference can trigger safety checkers which look for
drivers with unmet firmware dependencies.

Avoid referring to renesas_usb_fw.mem in circumstances when it cannot be
loaded (when CONFIG_USB_XHCI_PCI_RENESAS isn't set).

Signed-off-by: Greg Thelen <gthelen@google.com>
---
 drivers/usb/host/xhci-pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 18c2bbddf080..cb148da7a789 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -618,8 +618,10 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)
 /*-------------------------------------------------------------------------*/
 
 static const struct xhci_driver_data reneses_data = {
+#if IS_ENABLED(CONFIG_USB_XHCI_PCI_RENESAS)
 	.quirks  = XHCI_RENESAS_FW_QUIRK,
 	.firmware = "renesas_usb_fw.mem",
+#endif
 };
 
 /* PCI driver selection metadata; PCI hotplugging uses this */
@@ -636,7 +638,13 @@ static const struct pci_device_id pci_ids[] = {
 	{ /* end: all zeroes */ }
 };
 MODULE_DEVICE_TABLE(pci, pci_ids);
+/*
+ * Without CONFIG_USB_XHCI_PCI_RENESAS renesas_xhci_check_request_fw() won't
+ * load firmware, so don't encumber the xhci-pci driver with it.
+ */
+#if IS_ENABLED(CONFIG_USB_XHCI_PCI_RENESAS)
 MODULE_FIRMWARE("renesas_usb_fw.mem");
+#endif
 
 /* pci driver glue; this is a "new style" PCI driver module */
 static struct pci_driver xhci_pci_driver = {
-- 
2.32.0.93.g670b81a890-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-02  7:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-02  5:47 [PATCH] usb: xhci: avoid renesas_usb_fw.mem when it's unusable Greg Thelen
2021-07-02  5:56 ` Greg Kroah-Hartman
2021-07-02  7:11   ` Greg Thelen
2021-07-02  7:12     ` [PATCH V2] " Greg Thelen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.