Re: [PATCH] driver, virtio: Modify the err hanlding logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 20 Apr 2011 21:21:59 +0800, Liu Yuan <namei.unix@xxxxxxxxx> wrote:
> From: Liu Yuan <tailai.ly@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  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;

This patch is extremely marginal.  It theoretically improves efficiency,
but it's in a case we don't care about.  The code is quite clear.

My general policy for such marginal improvements is to only accept them
from the maintainer him/herself, so I won't be taking this patch.

Of course, if you produce a series of fixes to the driver with such a
patch as a cleaner, I'm lazy enough that I'd take them all at once :)

Thanks,
Rusty.
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/virtualization


[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux