[PATCH v2 3/5] PCI: tegra264: Use pcie_get_link_speed()

From: Hans Zhang

Date: Sun Nov 08 2026 - 04:43:05 EST


Tegra264 was added after pcie_get_link_speed() was introduced and still
indexes pcie_link_speed[] directly. Convert it to the helper so it does
not depend on the array being exported and cannot go out of bounds on
invalid speed values.

Signed-off-by: Hans Zhang <18255117159@xxxxxxx>
---
drivers/pci/controller/pcie-tegra264.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pcie-tegra264.c b/drivers/pci/controller/pcie-tegra264.c
index c97576ab4a31..711b66287681 100644
--- a/drivers/pci/controller/pcie-tegra264.c
+++ b/drivers/pci/controller/pcie-tegra264.c
@@ -126,7 +126,7 @@ static void tegra264_pcie_icc_set(struct tegra264_pcie *pcie)
width = FIELD_GET(PCI_EXP_LNKCAP_MLW, value);
}

- value = Mbps_to_icc(width * PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]));
+ value = Mbps_to_icc(width * PCIE_SPEED2MBS_ENC(pcie_get_link_speed(speed)));

/*
* We don't want to error out here because a boot-critical device
@@ -266,8 +266,8 @@ static bool tegra264_pcie_link_up(struct tegra264_pcie *pcie,

if (value & PCI_EXP_LNKSTA_DLLLA) {
if (speed)
- *speed = pcie_link_speed[FIELD_GET(PCI_EXP_LNKSTA_CLS,
- value)];
+ *speed = pcie_get_link_speed(FIELD_GET(PCI_EXP_LNKSTA_CLS,
+ value));

return true;
}
--
2.43.0