From: Wei Huang Date: Fri, 23 Oct 2020 08:59:56 +0000 (-0400) Subject: raw/ifpga/base: handle unsupported interrupt type X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=509579206fe07a2d714d5be1ed6f1adc51340be6;p=dpdk.git raw/ifpga/base: handle unsupported interrupt type Handle unsupported interrupt type requests properly, on unsupported interrupt case: 'ifpga_unregister_msix_irq()' returns success, 'ifpga_register_msix_irq()' return failure. Fixes: e0a1aafe2af9 ("raw/ifpga: introduce IRQ functions") Cc: stable@dpdk.org Signed-off-by: Wei Huang Signed-off-by: Tianfei Zhang Acked-by: Rosen Xu --- diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index e5b938d9d6..6319988066 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -1338,6 +1338,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); @@ -1367,8 +1369,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;