Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp714232pxu; Thu, 15 Oct 2020 14:48:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpcC2qr25MRm3Z30fGz987h4bkfUXl/LKySaC0egm4qORwuyRSlENLfeOo6xLvdr03egXN X-Received: by 2002:a17:906:2c41:: with SMTP id f1mr408274ejh.524.1602798530719; Thu, 15 Oct 2020 14:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602798530; cv=none; d=google.com; s=arc-20160816; b=JppX6k3aJ0HfQB9Mb+0a5JVaUD4iQ+28VpkTYYlt4FoBURzgTBMU2TO7Z84dCwqfQq ifmT+2sza/dkCDxs+XLSHnZbu0+Fp25lYxheH5eG/4QnFEXvrEiGgQ0A3lSmCiKU/DmA 2UmbdZZWA3MxSyyrjGwHENSXpFfu59skvMxn8fBak1zYNDUD9fZfD82tm1vZRUKaXmyM bmYpJopN+yY2flJY5PvS1ainO0gwYCvQCAxgd2IkSHzk0fqy/pbuTAFs+v9kQpckTSxO mRPj4f6MDivsF1g3KcFwh1gSJ/0MPlFr+SHklENdvRlho71/DxAxjTksNsXpMdWqt5iX POIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=UGWEJmn3x87fShrLqhp+smQvHKSMJgCYYbFBs2l6o5c=; b=KP+oft83uLAI3QHyuXz5LxYtoo2F7Y+Zvd9MwngwN91haZQbeUIPGvR217ihfIA9AV t+DO10MCMA2qQMXDuehWSD5rvPxoVG1zshRB2NygAWWGe6V4zCDvJNhfXUXSws4oEp3R Cshg2aXhrsYa8N3pDiuUmChj3DKEMdMgMSY0t7IK5YBotiCdND/geJYYVd+44aqnu/uN rcvMSB3cDWkYOsswF48kOLr7FZlF9I9yfVhz5H/xwV3zKK/KQbEojbyT/U0wee3Icawq YO5RM8cWHgpaTLvOtuNkHaYSDClOlBm+B6nZ6f7cmyVnF4gLOvZtbjW9Dii0ZfC1Wvq5 1uCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si152951edx.292.2020.10.15.14.48.28; Thu, 15 Oct 2020 14:48:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732883AbgJOSOV (ORCPT + 99 others); Thu, 15 Oct 2020 14:14:21 -0400 Received: from inva021.nxp.com ([92.121.34.21]:39982 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbgJOSOV (ORCPT ); Thu, 15 Oct 2020 14:14:21 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6A27B200780; Thu, 15 Oct 2020 20:14:19 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 5E0FC200608; Thu, 15 Oct 2020 20:14:19 +0200 (CEST) Received: from fsr-ub1864-111.ea.freescale.net (fsr-ub1864-111.ea.freescale.net [10.171.82.141]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 10C3A20309; Thu, 15 Oct 2020 20:14:19 +0200 (CEST) From: Diana Craciun To: alex.williamson@redhat.com, kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, laurentiu.tudor@nxp.com, colin.king@canonical.com, Diana Craciun Subject: [PATCH] vfio/fsl-mc: Fix the dead code in vfio_fsl_mc_set_irq_trigger Date: Thu, 15 Oct 2020 21:14:17 +0300 Message-Id: <20201015181417.28427-1-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.17.1