From: Diana Craciun Date: Thu, 15 Oct 2020 18:14:17 +0000 (+0300) Subject: vfio/fsl-mc: Fix the dead code in vfio_fsl_mc_set_irq_trigger X-Git-Tag: v5.10-rc1~53^2~3 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=159246378d8483ba63844fc03027df70501552c1;p=linux-2.6-block.git vfio/fsl-mc: Fix the dead code in vfio_fsl_mc_set_irq_trigger Static analysis discovered that some code in vfio_fsl_mc_set_irq_trigger is dead code. Fixed the code by changing the conditions order. Fixes: cc0ee20bd969 ("vfio/fsl-mc: trigger an interrupt via eventfd") Reported-by: Colin Ian King Signed-off-by: Diana Craciun Signed-off-by: Alex Williamson --- diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c b/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c index 2ce2acad3461..c80dceb46f79 100644 --- a/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c @@ -114,6 +114,9 @@ static int vfio_fsl_mc_set_irq_trigger(struct vfio_fsl_mc_device *vdev, struct device *cont_dev = fsl_mc_cont_dev(&mc_dev->dev); struct fsl_mc_device *mc_cont = to_fsl_mc_device(cont_dev); + if (!count && (flags & VFIO_IRQ_SET_DATA_NONE)) + return vfio_set_trigger(vdev, index, -1); + if (start != 0 || count != 1) return -EINVAL; @@ -128,9 +131,6 @@ static int vfio_fsl_mc_set_irq_trigger(struct vfio_fsl_mc_device *vdev, goto unlock; mutex_unlock(&vdev->reflck->lock); - if (!count && (flags & VFIO_IRQ_SET_DATA_NONE)) - return vfio_set_trigger(vdev, index, -1); - if (flags & VFIO_IRQ_SET_DATA_EVENTFD) { s32 fd = *(s32 *)data;