From patchwork Wed Jun 7 09:37:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 13270324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE733C7EE23 for ; Wed, 7 Jun 2023 09:56:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238654AbjFGJ47 (ORCPT ); Wed, 7 Jun 2023 05:56:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234789AbjFGJ46 (ORCPT ); Wed, 7 Jun 2023 05:56:58 -0400 Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55D12173B; Wed, 7 Jun 2023 02:56:56 -0700 (PDT) Received: from ed3e173716be.home.arpa (unknown [124.16.138.125]) by APP-03 (Coremail) with SMTP id rQCowAD3_y_cT4BkWqGxDA--.3849S2; Wed, 07 Jun 2023 17:37:33 +0800 (CST) From: Jiasheng Jiang To: james.smart@broadcom.com, ram.vegesna@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com, chenzhongjin@huawei.com, dwagner@suse.de, hare@suse.de Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] scsi: efct: Add missing check for ioremap Date: Wed, 7 Jun 2023 17:37:30 +0800 Message-Id: <20230607093730.18982-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: rQCowAD3_y_cT4BkWqGxDA--.3849S2 X-Coremail-Antispam: 1UD129KB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: pmld2xxhqjqxpvfd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Add check for ioremap() and return the error if it fails in order to guarantee the success of ioremap(). Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines") Signed-off-by: Jiasheng Jiang --- drivers/scsi/elx/efct/efct_driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/elx/efct/efct_driver.c b/drivers/scsi/elx/efct/efct_driver.c index 49fd2cfed70c..77c6252dcb3e 100644 --- a/drivers/scsi/elx/efct/efct_driver.c +++ b/drivers/scsi/elx/efct/efct_driver.c @@ -528,6 +528,8 @@ efct_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) { efct->reg[r] = ioremap(pci_resource_start(pdev, i), pci_resource_len(pdev, i)); + if (!efct->reg[r]) + goto ioremap_out; r++; } @@ -580,7 +582,7 @@ efct_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) efct_teardown_msix(efct); dma_mask_out: pci_set_drvdata(pdev, NULL); - +ioremap_out: for (i = 0; i < EFCT_PCI_MAX_REGS; i++) { if (efct->reg[i]) iounmap(efct->reg[i]);