Commit 15924637 authored by Diana Craciun's avatar Diana Craciun Committed by Alex Williamson

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: cc0ee20b ("vfio/fsl-mc: trigger an interrupt via eventfd")
Reported-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarDiana Craciun <diana.craciun@oss.nxp.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 83e49179
...@@ -114,6 +114,9 @@ static int vfio_fsl_mc_set_irq_trigger(struct vfio_fsl_mc_device *vdev, ...@@ -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 device *cont_dev = fsl_mc_cont_dev(&mc_dev->dev);
struct fsl_mc_device *mc_cont = to_fsl_mc_device(cont_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) if (start != 0 || count != 1)
return -EINVAL; return -EINVAL;
...@@ -128,9 +131,6 @@ static int vfio_fsl_mc_set_irq_trigger(struct vfio_fsl_mc_device *vdev, ...@@ -128,9 +131,6 @@ static int vfio_fsl_mc_set_irq_trigger(struct vfio_fsl_mc_device *vdev,
goto unlock; goto unlock;
mutex_unlock(&vdev->reflck->lock); 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) { if (flags & VFIO_IRQ_SET_DATA_EVENTFD) {
s32 fd = *(s32 *)data; s32 fd = *(s32 *)data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment