[PATCH v2 2/5] PCI: dwc: Check alloc_page() return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need to check alloc_page() succeed or not before continuing.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@xxxxxxxxxxxxx>
---
 drivers/pci/controller/dwc/pcie-designware-host.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 0a19de946351..9e04e8ef3aa4 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -303,6 +303,11 @@ void dw_pcie_msi_init(struct pcie_port *pp)
 	u64 msi_target;
 
 	pp->msi_page = alloc_page(GFP_KERNEL);
+	if (!pp->msi_page) {
+		dev_err(dev, "Failed to alloc MSI page\n");
+		return;
+	}
+
 	pp->msi_data = dma_map_page(dev, pp->msi_page, 0, PAGE_SIZE,
 				    DMA_FROM_DEVICE);
 	if (dma_mapping_error(dev, pp->msi_data)) {
-- 
2.28.0




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux