diff mbox series

[07/10] bus: mhi: pci_generic: Set register access length for MHI driver

Message ID 20210802051255.5771-8-manivannan.sadhasivam@linaro.org
State New
Headers show
Series MHI patches for v5.15 - Take 1 | expand

Commit Message

Manivannan Sadhasivam Aug. 2, 2021, 5:12 a.m. UTC
From: Bhaumik Bhatt <bbhatt@codeaurora.org>


MHI driver requires register space length to add range checks and
prevent memory region accesses outside of that for MMIO space.
Set it from the PCI generic controller driver before registering
the MHI controller.

Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>

Reviewed-by: Hemant Kumar <hemantk@codeaurora.org>

Reviewed-by: Loic Poulain <loic.poulain@linaro.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Link: https://lore.kernel.org/r/1620330705-40192-6-git-send-email-bbhatt@codeaurora.org
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

---
 drivers/bus/mhi/pci_generic.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.25.1
diff mbox series

Patch

diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c
index 6e1a86021b75..c772d94025fe 100644
--- a/drivers/bus/mhi/pci_generic.c
+++ b/drivers/bus/mhi/pci_generic.c
@@ -500,6 +500,7 @@  static int mhi_pci_claim(struct mhi_controller *mhi_cntrl,
 		return err;
 	}
 	mhi_cntrl->regs = pcim_iomap_table(pdev)[bar_num];
+	mhi_cntrl->reg_len = pci_resource_len(pdev, bar_num);
 
 	err = pci_set_dma_mask(pdev, dma_mask);
 	if (err) {