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

laurentiu.tudor at nxp.com laurentiu.tudor at nxp.com
Tue Feb 8 06:59:26 PST 2022


From: Laurentiu Tudor <laurentiu.tudor at 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 at nxp.com>
---
 drivers/bus/fsl-mc/dprc-driver.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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);
 
-- 
2.17.1




More information about the linux-arm-kernel mailing list