All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: xiangxia.m.yue@gmail.com
Cc: helgaas@kernel.org, hch@lst.de, linux-pci@vger.kernel.org
Subject: Re: [PATCH] pci: msi: return error code instead of only warn
Date: Tue, 25 Sep 2018 17:36:09 +0200	[thread overview]
Message-ID: <20180925153609.GB404@lst.de> (raw)
In-Reply-To: <1537797641-6868-1-git-send-email-xiangxia.m.yue@gmail.com>

On Mon, Sep 24, 2018 at 07:00:41AM -0700, xiangxia.m.yue@gmail.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> 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.

  reply	other threads:[~2018-09-25 15:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 14:00 [PATCH] pci: msi: return error code instead of only warn xiangxia.m.yue
2018-09-25 15:36 ` Christoph Hellwig [this message]
2018-09-25 20:30 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180925153609.GB404@lst.de \
    --to=hch@lst.de \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=xiangxia.m.yue@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.