Skip to content

Commit 4d1a2a9

Browse files
committed
Merge branch 'pci/bwctrl'
- Add set_pcie_speed.sh to TEST_PROGS to fix issue when executing the set_pcie_cooling_state.sh test case (Yi Lai) - Fix the pcie_bwctrl_select_speed() return value in cases where a non-compliant device doesn't advertise valid supported speeds (Ilpo Järvinen) - Avoid a NULL pointer dereference when we run out of bus numbers to assign for a bridge secondary bus (Lukas Wunner) * pci/bwctrl: PCI/bwctrl: Fix NULL pointer dereference on bus number exhaustion PCI/bwctrl: Fix pcie_bwctrl_select_speed() return type selftests/pcie_bwctrl: Add 'set_pcie_speed.sh' to TEST_PROGS
2 parents 2cde6eb + 667f053 commit 4d1a2a9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

drivers/pci/pcie/bwctrl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static u16 pcie_bwctrl_select_speed(struct pci_dev *port, enum pci_bus_speed spe
113113
up_read(&pci_bus_sem);
114114
}
115115
if (!supported_speeds)
116-
return PCI_EXP_LNKCAP2_SLS_2_5GB;
116+
supported_speeds = PCI_EXP_LNKCAP2_SLS_2_5GB;
117117

118118
return pcie_supported_speeds2target_speed(supported_speeds & desired_speeds);
119119
}
@@ -294,6 +294,10 @@ static int pcie_bwnotif_probe(struct pcie_device *srv)
294294
struct pci_dev *port = srv->port;
295295
int ret;
296296

297+
/* Can happen if we run out of bus numbers during enumeration. */
298+
if (!port->subordinate)
299+
return -ENODEV;
300+
297301
struct pcie_bwctrl_data *data = devm_kzalloc(&srv->device,
298302
sizeof(*data), GFP_KERNEL);
299303
if (!data)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
TEST_PROGS = set_pcie_cooling_state.sh
1+
TEST_PROGS = set_pcie_cooling_state.sh set_pcie_speed.sh
22
include ../lib.mk

0 commit comments

Comments
 (0)