Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5aadd04 authored by Tony Truong's avatar Tony Truong
Browse files

msm: pcie: check root pci dev is valid in msm_pcie_set_link_bandwidth



It's possible no root PCI device will be found given a child PCI
device. Add a check to make sure root PCI device is valid in
msm_pcie_set_link_bandwidth.

Change-Id: If6bbf3ec5dbd1475b2860c2532799e2b4873e75b
Signed-off-by: default avatarTony Truong <truong@codeaurora.org>
parent 6da887cb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -6230,6 +6230,9 @@ int msm_pcie_set_link_bandwidth(struct pci_dev *pci_dev, u16 target_link_speed,
		return -EINVAL;

	root_pci_dev = pci_find_pcie_root_port(pci_dev);
	if (!root_pci_dev)
		return -ENODEV;

	pcie_dev = PCIE_BUS_PRIV_DATA(root_pci_dev->bus);

	pcie_capability_read_word(root_pci_dev, PCI_EXP_LNKSTA, &link_status);