summaryrefslogtreecommitdiff
path: root/drivers/pci/controller
diff options
context:
space:
mode:
authorDamien Le Moal <dlemoal@kernel.org>2024-10-17 10:58:39 +0900
committerBjorn Helgaas <bhelgaas@google.com>2024-11-25 13:18:35 -0600
commitd8dbd21cfafd653b02ec187e59e0bcfaebd9a884 (patch)
tree9eb8901ef3e90fa99ffc88caeb2d51e4426990cc /drivers/pci/controller
parent57ed93fe799b3564388fd61279fc274ae2716508 (diff)
PCI: rockchip-ep: Improve rockchip_pcie_ep_map_addr()
Add a check to verify that the outbound region to be used for mapping an address is not already in use. Link: https://lore.kernel.org/r/20241017015849.190271-5-dlemoal@kernel.org Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Diffstat (limited to 'drivers/pci/controller')
-rw-r--r--drivers/pci/controller/pcie-rockchip-ep.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c
index b4db5459727f..24ee1df17a49 100644
--- a/drivers/pci/controller/pcie-rockchip-ep.c
+++ b/drivers/pci/controller/pcie-rockchip-ep.c
@@ -246,6 +246,9 @@ static int rockchip_pcie_ep_map_addr(struct pci_epc *epc, u8 fn, u8 vfn,
struct rockchip_pcie *pcie = &ep->rockchip;
u32 r = rockchip_ob_region(addr);
+ if (test_bit(r, &ep->ob_region_map))
+ return -EBUSY;
+
rockchip_pcie_prog_ep_ob_atu(pcie, fn, r, addr, pci_addr, size);
set_bit(r, &ep->ob_region_map);