mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] driver, virtio: Modify the err hanlding logic
@ 2011-04-20 13:21 Liu Yuan
  2011-04-27  5:04 ` Rusty Russell
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Yuan @ 2011-04-20 13:21 UTC (permalink / raw)
  To: Rusty Russell, Michael S. Tsirkin; +Cc: virtualization, linux-kernel

From: Liu Yuan <tailai.ly@taobao.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@taobao.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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-04-27  6:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 13:21 [PATCH] driver, virtio: Modify the err hanlding logic Liu Yuan
2011-04-27  5:04 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®