From: Wayne Boyer <wayneb@linux.vnet.ibm.com>
To: Julia Lawall <julia@diku.dk>
Cc: Brian King <brking@us.ibm.com>,
kernel-janitors@vger.kernel.org,
"James E.J. Bottomley" <JBottomley@parallels.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/scsi/ipr.c: reorder error handling code to include iounmap
Date: Thu, 09 Jun 2011 08:51:28 -0700 [thread overview]
Message-ID: <4DF0EC00.9020603@linux.vnet.ibm.com> (raw)
In-Reply-To: <1306851409-14963-1-git-send-email-julia@diku.dk>
On 05/31/2011 07:16 AM, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> The out_msi_disable label should be before cleanup_nomem to additionally
> benefit from the call to iounmap.
Yes, this is a problem. I propose the following patch instead.
---
In the case where ipr_test_msi returns an error that is not -EOPNOTSUPP, the
execution jumps to the out_msi_disable label. This misses the call to iounmap
for ipr_regs which was initialized earlier.
The fix is to do the call to pci_disable_msi when the error case is detected
and then goto the cleanup_nomem label if the error is not -EOPNOTSUPP.
Signed-off-by: Wayne Boyer <wayneb@linux.vnet.ibm.com>
---
drivers/scsi/ipr.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
Index: b/drivers/scsi/ipr.c
===================================================================
--- a/drivers/scsi/ipr.c 2011-06-09 08:14:44.927740117 -0700
+++ b/drivers/scsi/ipr.c 2011-06-09 08:50:10.105630466 -0700
@@ -8763,11 +8763,11 @@ static int __devinit ipr_probe_ioa(struc
/* Enable MSI style interrupts if they are supported. */
if (ioa_cfg->ipr_chip->intr_type == IPR_USE_MSI && !pci_enable_msi(pdev)) {
rc = ipr_test_msi(ioa_cfg, pdev);
- if (rc == -EOPNOTSUPP)
+ if (rc) {
pci_disable_msi(pdev);
- else if (rc)
- goto out_msi_disable;
- else
+ if (rc != -EOPNOTSUPP)
+ goto cleanup_nomem;
+ } else
dev_info(&pdev->dev, "MSI enabled with IRQ: %d\n", pdev->irq);
} else if (ipr_debug)
dev_info(&pdev->dev, "Cannot enable MSI.\n");
@@ -8847,8 +8847,6 @@ cleanup_nolog:
ipr_free_mem(ioa_cfg);
cleanup_nomem:
iounmap(ipr_regs);
-out_msi_disable:
- pci_disable_msi(pdev);
out_release_regions:
pci_release_regions(pdev);
out_scsi_host_put:
--
Wayne Boyer
IBM - Beaverton, Oregon
LTC S/W Development
(503) 578-5236, T/L 775-5236
next prev parent reply other threads:[~2011-06-09 15:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-31 14:16 [PATCH] drivers/scsi/ipr.c: reorder error handling code to include iounmap Julia Lawall
2011-06-01 15:02 ` Brian King
2011-06-09 15:51 ` Wayne Boyer [this message]
2011-06-14 16:09 ` Brian King
2011-06-15 8:50 ` Julia Lawall
2011-06-20 16:47 ` Wayne Boyer
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=4DF0EC00.9020603@linux.vnet.ibm.com \
--to=wayneb@linux.vnet.ibm.com \
--cc=JBottomley@parallels.com \
--cc=brking@us.ibm.com \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).