diff mbox series

[4/6] bus: fsl-mc: check for null irq array

Message ID 20220208145928.12468-5-laurentiu.tudor@nxp.com (mailing list archive)
State New, archived
Headers show
Series bus: fsl-mc: fixes and .shutdown() op for dprc driver | expand

Commit Message

Laurentiu Tudor Feb. 8, 2022, 2:59 p.m. UTC
From: Laurentiu Tudor <laurentiu.tudor@nxp.com>

In VFIO case, the irq array in the fsl_mc device is not initialized,
so given that in upcoming patches this code will also get called by
VFIO add a check for null in the irq teardown function.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
---
 drivers/bus/fsl-mc/dprc-driver.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c
index 36681cf7c42e..8482c4fca835 100644
--- a/drivers/bus/fsl-mc/dprc-driver.c
+++ b/drivers/bus/fsl-mc/dprc-driver.c
@@ -767,7 +767,12 @@  static int dprc_probe(struct fsl_mc_device *mc_dev)
  */
 static void dprc_teardown_irq(struct fsl_mc_device *mc_dev)
 {
-	struct fsl_mc_device_irq *irq = mc_dev->irqs[0];
+	struct fsl_mc_device_irq *irq;
+
+	if (!mc_dev->irqs)
+		return;
+
+	irq = mc_dev->irqs[0];
 
 	(void)disable_dprc_irq(mc_dev);