[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1303305719-4475-1-git-send-email-namei.unix@gmail.com>
Date: Wed, 20 Apr 2011 21:21:59 +0800
From: Liu Yuan <namei.unix@...il.com>
To: Rusty Russell <rusty@...tcorp.com.au>,
"Michael S. Tsirkin" <mst@...hat.com>
Cc: virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] driver, virtio: Modify the err hanlding logic
From: Liu Yuan <tailai.ly@...bao.com>
In the function vp_request_msix_vectors(), when
pci_enable_msix() returns 0, there will be
redundant double checks for 'err'. This patch
fixes it to avoid the unnecessary check.
Signed-off-by: Liu Yuan <tailai.ly@...bao.com>
---
drivers/virtio/virtio_pci.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 4fb5b2b..2c05376 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -298,10 +298,11 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
/* pci_enable_msix returns positive if we can't get this many. */
err = pci_enable_msix(vp_dev->pci_dev, vp_dev->msix_entries, nvectors);
- if (err > 0)
- err = -ENOSPC;
- if (err)
+ if (err) {
+ if (err > 0)
+ err = -ENOSPC;
goto error;
+ }
vp_dev->msix_vectors = nvectors;
vp_dev->msix_enabled = 1;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists