From patchwork Thu Jan 5 07:43:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9498541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB0F360235 for ; Thu, 5 Jan 2017 07:44:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9BB127F90 for ; Thu, 5 Jan 2017 07:44:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C0D127FA9; Thu, 5 Jan 2017 07:44:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 468FB27F90 for ; Thu, 5 Jan 2017 07:44:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967344AbdAEHn7 (ORCPT ); Thu, 5 Jan 2017 02:43:59 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36369 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967180AbdAEHn6 (ORCPT ); Thu, 5 Jan 2017 02:43:58 -0500 Received: by mail-pg0-f67.google.com with SMTP id 75so1648906pgf.3; Wed, 04 Jan 2017 23:43:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=d8FsE9iilm5hrGfTWchH++HpjQ1TwnZlIhLEAbiyao0=; b=Fx1Ue0pFEH2r5zNas3Wtls8f+dTGDw2d8cgeFxGPDUvZzdTHUT9I3jppeI7v+9OTrx 6Jzsu+8VS7blj27hbHmILqdPa+wScyPNP9aZ43WOc90Ah235h+ENTTI9GGd4NOmspSNX 3NntyybKEzUsHFz1ZrV/z+aLc8IalRtyeWpUwYv+jJ0SXx2XOmM43uxd+LTymFSM+otq 5+FWdkFWrZkkCGV0YwfKy1KmdW+EuKV77FT5ZukZmz/LcuLNIxbWFU4rIa//iRQ4tVdl 9QpUk68m+7a9tLwJ2h2kwGG+u+kqWjBTVOg7QqBOqtRyW8DqviH6YQZxTYdMwNjghVTC CgEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=d8FsE9iilm5hrGfTWchH++HpjQ1TwnZlIhLEAbiyao0=; b=mAx3ozVgZG2kYnlzehEiGyQis0vG5gH6s0TB8kUj+SEZgMNRh2zovzM0kU+dojHJOB /1DadKGIvFzgGziR4Q7mTMcuQrvyZeYiFMr2mi/lKstrOqKGP0TD0zmCmT5FCg6tYTBK fTShSHF1ZeVtdfHmM8MnVBgbLwgcai76RBT8rzlKyzqkwvG4krsWbZxCbC53j2Ys/eoV TiDyR2OL0Jj8buv1f5xY9RODL2ZTorEj+zVkdrZbugzajyuyUM/D8cr/GGBlgxtzONqF c+UvbH6Q8cBh6wJLnF23Pd4s6Wi+aCfCYf2+67JKKTGKtsWCHW7cDKH5DKteOrMmp3m7 QBNw== X-Gm-Message-State: AIkVDXLvmLWDGo240r784iQRJ7rQvXqoLfQbcx3ZBWPq+FM0ea5lPZfWjPfs0gj95vtgVg== X-Received: by 10.84.197.131 with SMTP id n3mr151384354pld.6.1483602237523; Wed, 04 Jan 2017 23:43:57 -0800 (PST) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id j130sm127873661pgc.2.2017.01.04.23.43.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jan 2017 23:43:56 -0800 (PST) From: Arvind Yadav 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 Message-Id: <1483602196-25605-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Free memory regions, if qlafx00_iospace_config is not successful. Signed-off-by: Arvind Yadav --- 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; }