RE: [PATCH V4 10/11] vfio/pci: Support dynamic MSI-X

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

 



> From: Chatre, Reinette <reinette.chatre@xxxxxxxxx>
> Sent: Saturday, May 6, 2023 1:21 AM
> 
> Would you be ok with something like below?
> 
> diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
> index b549f5c97cb8..a8e96254f953 100644
> --- a/drivers/vfio/pci/vfio_pci_intrs.c
> +++ b/drivers/vfio/pci/vfio_pci_intrs.c
> @@ -393,6 +393,8 @@ static int vfio_msi_alloc_irq(struct
> vfio_pci_core_device *vdev,
>  	u16 cmd;
> 
>  	irq = pci_irq_vector(pdev, vector);
> +	if (WARN_ON_ONCE(irq == 0))
> +		return -EINVAL;
>  	if (irq > 0 || !msix || !vdev->has_dyn_msix)
>  		return irq;
> 
> I would prefer that vfio_msi_alloc_irq() returns negative errors. This enables
> callers to in turn just return the error code on failure (note that dynamic
> allocation can return different error codes), not needing to translate 0 into
> an error.
> 

This looks good to me. Thanks.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux