mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com
Cc: qla2xxx-upstream@qlogic.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [v1] scsi: qla2xxx: qla_mr:- Release and Unmap memory regions when an error occurred.
Date: Thu,  5 Jan 2017 13:13:16 +0530	[thread overview]
Message-ID: <1483602196-25605-1-git-send-email-arvind.yadav.cs@gmail.com> (raw)

Free memory regions, if qlafx00_iospace_config is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/scsi/qla2xxx/qla_mr.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
index 02f1de1..2861df8 100644
--- a/drivers/scsi/qla2xxx/qla_mr.c
+++ b/drivers/scsi/qla2xxx/qla_mr.c
@@ -770,7 +770,7 @@
 		ql_log_pci(ql_log_fatal, ha->pdev, 0x014e,
 		    "Failed to reserve PIO/MMIO regions (%s), aborting.\n",
 		    pci_name(ha->pdev));
-		goto iospace_error_exit;
+		return -ENOMEM;
 	}
 
 	/* Use MMIO operations for all accesses. */
@@ -799,13 +799,13 @@
 		ql_log_pci(ql_log_warn, ha->pdev, 0x0129,
 		    "region #2 not an MMIO resource (%s), aborting\n",
 		    pci_name(ha->pdev));
-		goto iospace_error_exit;
+		goto iounmap_error_exit;
 	}
 	if (pci_resource_len(ha->pdev, 2) < BAR2_LEN_FX00) {
 		ql_log_pci(ql_log_warn, ha->pdev, 0x012a,
 		    "Invalid PCI mem BAR2 region size (%s), aborting\n",
 			pci_name(ha->pdev));
-		goto iospace_error_exit;
+		goto iounmap_error_exit;
 	}
 
 	ha->iobase =
@@ -813,7 +813,7 @@
 	if (!ha->iobase) {
 		ql_log_pci(ql_log_fatal, ha->pdev, 0x012b,
 		    "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev));
-		goto iospace_error_exit;
+		goto iounmap_error_exit;
 	}
 
 	/* Determine queue resources */
@@ -825,7 +825,10 @@
 
 	return 0;
 
+iounmap_error_exit:
+	iounmap(ha->cregbase);
 iospace_error_exit:
+	pci_release_selected_regions(ha->pdev, ha->bars);
 	return -ENOMEM;
 }
 
-- 
1.9.1

                 reply	other threads:[~2017-01-05  7:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1483602196-25605-1-git-send-email-arvind.yadav.cs@gmail.com \
    --to=arvind.yadav.cs@gmail.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=qla2xxx-upstream@qlogic.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

all inboxes | Powered by JetHome®