aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2015-04-09 15:34:10 -0400
committerBjorn Helgaas <bhelgaas@google.com>2015-04-09 15:34:10 -0400
commitf76ea574d615cd003b2fc51580006f7dc220897c (patch)
tree599cd3ee2975f41304a51993d461365e98272714 /drivers/pci
parentc517d838eb7d07bbe9507871fab3931deccff539 (diff)
PCI: keystone: Don't dereference possible NULL pointer
Check for failure from platform_get_resource() (this check actually happens inside devm_ioremap_resource()) before dereferencing the pointer returned from platform_get_resource(). Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/host/pci-keystone-dw.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pci/host/pci-keystone-dw.c b/drivers/pci/host/pci-keystone-dw.c
index 66d8ea41b972..f34892e0edb4 100644
--- a/drivers/pci/host/pci-keystone-dw.c
+++ b/drivers/pci/host/pci-keystone-dw.c
@@ -496,11 +496,12 @@ int __init ks_dw_pcie_host_init(struct keystone_pcie *ks_pcie,
496 496
497 /* Index 1 is the application reg. space address */ 497 /* Index 1 is the application reg. space address */
498 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 498 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
499 ks_pcie->app = *res;
500 ks_pcie->va_app_base = devm_ioremap_resource(pp->dev, res); 499 ks_pcie->va_app_base = devm_ioremap_resource(pp->dev, res);
501 if (IS_ERR(ks_pcie->va_app_base)) 500 if (IS_ERR(ks_pcie->va_app_base))
502 return PTR_ERR(ks_pcie->va_app_base); 501 return PTR_ERR(ks_pcie->va_app_base);
503 502
503 ks_pcie->app = *res;
504
504 /* Create legacy IRQ domain */ 505 /* Create legacy IRQ domain */
505 ks_pcie->legacy_irq_domain = 506 ks_pcie->legacy_irq_domain =
506 irq_domain_add_linear(ks_pcie->legacy_intc_np, 507 irq_domain_add_linear(ks_pcie->legacy_intc_np,