summary refs log tree commit diff
path: root/drivers/usb/cdns3
diff options
context:
space:
mode:
authorPawel Laszczak <pawell@cadence.com>2023-03-08 07:44:27 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-30 12:49:24 +0200
commit0cc5fbfaacaa789e48d984eb65f3b1f5df9a5602 (patch)
tree2f8c83ae36bd3cd389a95d0e8061c28253947245 /drivers/usb/cdns3
parentd55ca2d2ea1a7ec553213986993fba8c0257381c (diff)
downloadlinux-0cc5fbfaacaa789e48d984eb65f3b1f5df9a5602.tar.gz
usb: cdns3: Fix issue with using incorrect PCI device function
commit 1272fd652a226ccb34e9f47371b6121948048438 upstream.

PCI based platform can have more than two PCI functions.
USBSS PCI Glue driver during initialization should
consider only DRD/HOST/DEVICE PCI functions and
all other should be ignored. This patch adds additional
condition which causes that only DRD and HOST/DEVICE
function will be accepted.

cc: <stable@vger.kernel.org>
Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20230308124427.311245-1-pawell@cadence.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/cdns3')
-rw-r--r--drivers/usb/cdns3/cdns3-pci-wrap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/cdns3/cdns3-pci-wrap.c b/drivers/usb/cdns3/cdns3-pci-wrap.c
index deeea618ba33..1f6320d98a76 100644
--- a/drivers/usb/cdns3/cdns3-pci-wrap.c
+++ b/drivers/usb/cdns3/cdns3-pci-wrap.c
@@ -60,6 +60,11 @@ static struct pci_dev *cdns3_get_second_fun(struct pci_dev *pdev)
 			return NULL;
 	}
 
+	if (func->devfn != PCI_DEV_FN_HOST_DEVICE &&
+	    func->devfn != PCI_DEV_FN_OTG) {
+		return NULL;
+	}
+
 	return func;
 }