summaryrefslogtreecommitdiff
path: root/drivers/pci/host/pci-msm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/host/pci-msm.c')
-rw-r--r--drivers/pci/host/pci-msm.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/pci/host/pci-msm.c b/drivers/pci/host/pci-msm.c
index 0ecf64f4afe9..b180e67acafb 100644
--- a/drivers/pci/host/pci-msm.c
+++ b/drivers/pci/host/pci-msm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -2421,6 +2421,13 @@ static void msm_pcie_sel_debug_testcase(struct msm_pcie_dev_t *dev,
break;
}
+ if (((base_sel - 1) >= MSM_PCIE_MAX_RES) ||
+ (!dev->res[base_sel - 1].resource)) {
+ PCIE_DBG_FS(dev, "PCIe: RC%d Resource does not exist\n",
+ dev->rc_idx);
+ break;
+ }
+
PCIE_DBG_FS(dev,
"base: %s: 0x%p\nwr_offset: 0x%x\nwr_mask: 0x%x\nwr_value: 0x%x\n",
dev->res[base_sel - 1].name,
@@ -2440,6 +2447,13 @@ static void msm_pcie_sel_debug_testcase(struct msm_pcie_dev_t *dev,
break;
case 13: /* dump all registers of base_sel */
+ if (((base_sel - 1) >= MSM_PCIE_MAX_RES) ||
+ (!dev->res[base_sel - 1].resource)) {
+ PCIE_DBG_FS(dev, "PCIe: RC%d Resource does not exist\n",
+ dev->rc_idx);
+ break;
+ }
+
if (!base_sel) {
PCIE_DBG_FS(dev, "Invalid base_sel: 0x%x\n", base_sel);
break;
@@ -6798,7 +6812,7 @@ static int msm_pcie_pm_suspend(struct pci_dev *dev,
return ret;
}
-static void msm_pcie_fixup_suspend(struct pci_dev *dev)
+static void msm_pcie_fixup_suspend_late(struct pci_dev *dev)
{
int ret;
struct msm_pcie_dev_t *pcie_dev = PCIE_BUS_PRIV_DATA(dev->bus);
@@ -6830,8 +6844,8 @@ static void msm_pcie_fixup_suspend(struct pci_dev *dev)
mutex_unlock(&pcie_dev->recovery_lock);
}
-DECLARE_PCI_FIXUP_SUSPEND(PCIE_VENDOR_ID_RCP, PCIE_DEVICE_ID_RCP,
- msm_pcie_fixup_suspend);
+DECLARE_PCI_FIXUP_SUSPEND_LATE(PCIE_VENDOR_ID_RCP, PCIE_DEVICE_ID_RCP,
+ msm_pcie_fixup_suspend_late);
/* Resume the PCIe link */
static int msm_pcie_pm_resume(struct pci_dev *dev,