[v3,2/5] raw/ifpga/base: handle unsupported interrupt type
diff mbox series

Message ID 1603443599-7356-3-git-send-email-tianfei.zhang@intel.com
State Accepted
Delegated to: Qi Zhang
Headers show
Series
  • raw/ifpga/base: An improvement for multi-process
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Zhang, Tianfei Oct. 23, 2020, 8:59 a.m. UTC
From: Wei Huang <wei.huang@intel.com>

Handle unsupported interrupt type requests properly,
on unsupported interrupt case:
'ifpga_unregister_msix_irq()' returns success,
'ifpga_register_msix_irq()' return failure.

Fixes: e0a1aafe ("raw/ifpga: introduce IRQ functions")
Cc: stable@dpdk.org

Signed-off-by: Wei Huang <wei.huang@intel.com>
Signed-off-by: Tianfei zhang <tianfei.zhang@intel.com>
---
 drivers/raw/ifpga/ifpga_rawdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 76b0f8a5b..374a7ff1d 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1343,6 +1343,8 @@  ifpga_unregister_msix_irq(enum ifpga_irq_type type,
 		intr_handle = &ifpga_irq_handle[0];
 	else if (type == IFPGA_AFU_IRQ)
 		intr_handle = &ifpga_irq_handle[vec_start + 1];
+	else
+		return 0;
 
 	rte_intr_efd_disable(intr_handle);
 
@@ -1372,8 +1374,11 @@  ifpga_register_msix_irq(struct rte_rawdev *dev, int port_id,
 	if (type == IFPGA_FME_IRQ) {
 		intr_handle = &ifpga_irq_handle[0];
 		count = 1;
-	} else if (type == IFPGA_AFU_IRQ)
+	} else if (type == IFPGA_AFU_IRQ) {
 		intr_handle = &ifpga_irq_handle[vec_start + 1];
+	} else {
+		return -EINVAL;
+	}
 
 	intr_handle->type = RTE_INTR_HANDLE_VFIO_MSIX;