public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ching <ching2048@areca.com.tw>
Cc: jbottomley@parallels.com, thenzl@redhat.com,
	linux-scsi@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1.1 2/16] arcmsr:  Adding code to support MSI-X interrupt
Date: Mon, 5 May 2014 13:28:30 +0300	[thread overview]
Message-ID: <20140505102830.GN4963@mwanda> (raw)
In-Reply-To: <1399279631.18695.27.camel@localhost>

On Mon, May 05, 2014 at 04:47:11PM +0800, ching wrote:
> +static int
> +arcmsr_request_irq(struct pci_dev *pdev, struct AdapterControlBlock *acb)
> +{
> +	int	i, j, r;
> +	struct msix_entry entries[ARCMST_NUM_MSIX_VECTORS];
> +
> +	if (!pci_find_capability(pdev, PCI_CAP_ID_MSIX))
> +		goto msi_int;
> +	for (i = 0; i < ARCMST_NUM_MSIX_VECTORS; i++)
> +		entries[i].entry = i;
> +	r = pci_enable_msix(pdev, entries, ARCMST_NUM_MSIX_VECTORS);
> +	if (r < 0)
> +		goto msi_int;
> +	if (r == 0) {
> +		for (i = 0; i < ARCMST_NUM_MSIX_VECTORS; i++) {
> +			if (request_irq(entries[i].vector,
> +				arcmsr_do_interrupt, 0, "arcmsr", acb)) {
> +				pr_warn("arcmsr%d: request_irq =%d failed!\n",
> +					acb->host->host_no, pdev->irq);
> +				for (j = 0 ; j < i ; j++)
> +					free_irq(entries[i].vector, acb);

This is a bug here.  Sorry for not noticing the first time I reviewed
this patch.  It should be "j" instead of "i" in
free_irq(entries[i].vector, acb);.

> +				pci_disable_msix(pdev);
> +				goto msi_int;
> +			}
> +			acb->entries[i] = entries[i];
> +		}
> +		acb->acb_flags |= ACB_F_MSIX_ENABLED;
> +		pr_info("arcmsr%d: msi-x enabled\n", acb->host->host_no);
> +		return ARC_SUCCESS;
> +	} else {
> +		if (pci_enable_msix(pdev, entries, r))
> +			goto msi_int;
> +		for (i = 0; i < r; i++) {
> +			if (request_irq(entries[i].vector,
> +				arcmsr_do_interrupt, 0, "arcmsr", acb)) {
> +				pr_warn("arcmsr%d: request_irq =%d failed!\n",
> +					acb->host->host_no, pdev->irq);
> +				for (j = 0 ; j < i ; j++)
> +					free_irq(entries[i].vector, acb);

The same thing here.

But otherwise so far as style goes this function is a lot better in
this version.  Thanks.  Also the patchset is split up nicely into
patches which do one thing per patch so that's nice as well.

regards,
dan carpenter


  reply	other threads:[~2014-05-05 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-05  8:47 [PATCH v1.1 2/16] arcmsr: Adding code to support MSI-X interrupt ching
2014-05-05 10:28 ` Dan Carpenter [this message]
2014-05-05 10:43   ` 黃清隆

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=20140505102830.GN4963@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ching2048@areca.com.tw \
    --cc=jbottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=thenzl@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox