Add pcie port pointer validation to avoid a potencial crash accessing a null pointer reported by coverity scan. Warning generated by coverity: "Dereferencing a pointer that might be null "data" when calling "irq_data_get_irq_chip_data". Signed-off-by: Gustavo Pimentel <gustavo.pimentel@xxxxxxxxxxxx> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx> Cc: Joao Pinto <jpinto@xxxxxxxxxxxx> Cc: Jingoo Han <jingoohan1@xxxxxxxxx> --- drivers/pci/controller/dwc/pcie-designware-host.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 45ff5e4..419a56b 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -256,9 +256,14 @@ static void dw_pcie_irq_domain_free(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs) { struct irq_data *d = irq_domain_get_irq_data(domain, virq); - struct pcie_port *pp = irq_data_get_irq_chip_data(d); + struct pcie_port *pp; unsigned long flags; + if (!d) + return; + + pp = irq_data_get_irq_chip_data(d); + raw_spin_lock_irqsave(&pp->lock, flags); bitmap_release_region(pp->msi_irq_in_use, d->hwirq, -- 2.7.4