Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f76ea574 authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

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: default avatarBjorn Helgaas <bhelgaas@google.com>
parent c517d838
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -496,11 +496,12 @@ int __init ks_dw_pcie_host_init(struct keystone_pcie *ks_pcie,


	/* Index 1 is the application reg. space address */
	/* Index 1 is the application reg. space address */
	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
	ks_pcie->app = *res;
	ks_pcie->va_app_base = devm_ioremap_resource(pp->dev, res);
	ks_pcie->va_app_base = devm_ioremap_resource(pp->dev, res);
	if (IS_ERR(ks_pcie->va_app_base))
	if (IS_ERR(ks_pcie->va_app_base))
		return PTR_ERR(ks_pcie->va_app_base);
		return PTR_ERR(ks_pcie->va_app_base);


	ks_pcie->app = *res;

	/* Create legacy IRQ domain */
	/* Create legacy IRQ domain */
	ks_pcie->legacy_irq_domain =
	ks_pcie->legacy_irq_domain =
			irq_domain_add_linear(ks_pcie->legacy_intc_np,
			irq_domain_add_linear(ks_pcie->legacy_intc_np,