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

From: laurentiu . tudor
Date: Tue Feb 08 2022 - 10:00:11 EST


From: Laurentiu Tudor <laurentiu.tudor@xxxxxxx>

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@xxxxxxx>
---
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