Re: [PATCH] pci: msi: return error code instead of only warn

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

 



On Mon, Sep 24, 2018 at 07:00:41AM -0700, xiangxia.m.yue@xxxxxxxxx wrote:
> From: Tonghao Zhang <xiangxia.m.yue@xxxxxxxxx>
> 
> The drivers may enable the msi/msix more than once.
> Actually, this is the driver bug. But the bug may panic
> the kernel and should be fixed. We can return the error
> code instead of WARN_ON, to tell the drivers that the
> msi/msix is already enabled.
> 
> When enable them again, the call tree is shown on kernel
> 3.10.0, but linux upstream in the same way.

You can use up to 73 characters per line for your changelog, and doing so
makes it a little more readable.

> +	if (WARN_ON_ONCE(!!dev->msi_enabled))
> +		return  -EINVAL;
> +
>  	nvec = pci_msi_vec_count(dev);
>  	if (nvec < 0)
>  		return nvec;
> @@ -1087,6 +1087,9 @@ static int __pci_enable_msix_range(struct pci_dev *dev,
>  	if (maxvec < minvec)
>  		return -ERANGE;
>  
> +	if (WARN_ON_ONCE(!!dev->msix_enabled))
> +		return  -EINVAL;
> +

You can drop the "!!", WARN_ON_ONCE will do the implicit bool conversion
for you.

Except for that the patch looks good to me.



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux