Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3780069imm; Mon, 11 Jun 2018 01:27:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL+4cgbQh8B5UJfuN0Qeaco/sTlEId95QtCY7VDRce4C3bAISh4uC0o1AlCr/z0fuBnddz6 X-Received: by 2002:a17:902:294a:: with SMTP id g68-v6mr757265plb.58.1528705628819; Mon, 11 Jun 2018 01:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528705628; cv=none; d=google.com; s=arc-20160816; b=wIETaMVfDjh/gnk/6tkICbPZ2NqHh/lmdFTHzgmItnfFrMJtGRS0M7r1JIz0vFxjn/ +zUsLVZSlo2rp38uQ/MP7gGDr+trSppcJ28ym6CQ/lTir6RRk+VVUlanVP67qkoecXxY MwNCzHpFwvV3T25NuzKKAdvY0LcSq07+Kl+Cz0EQaGZd9s+ONROZBY0BpgAyZ4QT+N4z 7JtnxWn0phkEOIqAS6kwCLlW9kfzhix8GWsErM3UVC5q/QZywH8LQo8u/31nyYbeHu1f QoL5a5lSvygC3b0gd3DfP4B6SsGT59XXZon/HVCYdWavA8f9wkpZiO4XiFpeQCcEwPSp y1cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=TVVOEI6h0780tnAylhUZDND+FOZfDBDaGWtZb7OFp9A=; b=aG0bbLG+R+WapD1o3i5FfGONaLgZYPiX409DxrKdPg4Ibq0NA+Z3D0Sbxz4+drKsgx IAGqHsj+WVTC7gb7ksM3aAuLgJMV2q9/5ya6GuFm5wwylxqXTLhHWBUx1K2chB13LEGZ kcVZqgJe1Bkb49S08Y+1qrSR2q2QM9ZNDlDO3gal8YlZvdjcOGG0LMPTsodWu8HiTB37 ImqurXkun9kdEQv3ihQCi7kTMKSeggrN2t2IKXZf4q5B1ncN7K9s81RY0Xxjv9iPeF6K y4Q5eCwEq1RmdX291L4Ur6rtHnuZk69A4gLRVlwIztxEDdlZQNoHaW72FVqsc43j7vDZ 87vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=kNThQjms; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3-v6si46046884pgc.300.2018.06.11.01.26.54; Mon, 11 Jun 2018 01:27:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=kNThQjms; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754122AbeFKI0a (ORCPT + 99 others); Mon, 11 Jun 2018 04:26:30 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:36492 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754010AbeFKI02 (ORCPT ); Mon, 11 Jun 2018 04:26:28 -0400 Received: by mail-pl0-f65.google.com with SMTP id a7-v6so9404699plp.3; Mon, 11 Jun 2018 01:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=TVVOEI6h0780tnAylhUZDND+FOZfDBDaGWtZb7OFp9A=; b=kNThQjmsMATe3qwDCv9QI6u7T4YpZVow05YzK30myIG7obWl55CwdmqEQl6exaKgTH xCB+S4H5UekKDtOtBz5OTWKMubVcYBYUILqdM+m7UgfplU6A5SJ8tXvfWacxHGjdtpoi 4OYYGVlQBOF1wTEFEx9BE9XJdbq+RhQr6WDgfY1E4bwSWJ6MQ1KWL3W/2bqF93o/TBeg HaEKKv5vYma8kzBsDhv/jCMpotoRL9WyMGsSZXDZvscVo6gfERFeirtFx0RuyUEeyOiF SzsW80aeXOnGIAiTkmxae5UhAZrqE0MC+vjGUlxTzaN1nSF88x+HLBwEWzm3Jvndo6MG eBSA== 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=TVVOEI6h0780tnAylhUZDND+FOZfDBDaGWtZb7OFp9A=; b=kv3j5XJssR6j8jUF+C7kLJLo3nBMm3FLmO9Zrt0KtbtPXGoex2QAItgkOrZPab936r 4jDD+1PhM4Cje8DsQB8U9RUygfpUFYHfRRGvDheGn5ahzbjYfE1nqH5I77BZHmOoHZwM bU5et5wIbJdRK2pQNKryDcEKlWXIPEKqg3FC/USUssfnYY4aSH67fep1SlJzXLnx2Rmt 6AzA09Hm6MDHVJ6WjKaeCEtKV17zT4IB8Svtjpajyh5tE1zfg7XkYxf13kxL+bwrX07P qGDuhqzkq//mJvBeIxXtUr9lR6iFlc6JetbIOab9dR/xAHi1WU5OG05zmCCRCDuQIV/Q sC1g== X-Gm-Message-State: APt69E3z1odpbKi745K1txJXXlSYfpwJglX3BLZiwqnzDkYcnPDEk80q EDhLltdFKD6WFsS4yLxpmqM= X-Received: by 2002:a17:902:264:: with SMTP id 91-v6mr17198127plc.341.1528705588389; Mon, 11 Jun 2018 01:26:28 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id w125-v6sm16988020pgb.92.2018.06.11.01.26.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 01:26:27 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Anil Gurumurthy , Sudarsana Kalluru , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: bfa: add error handling for pci_iomap Date: Mon, 11 Jun 2018 16:26:21 +0800 Message-Id: <1528705581-34646-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When pci_iomap fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling pci_iomap. Signed-off-by: Zhouyang Jia --- drivers/scsi/bfa/bfad.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index bd7e6a6f..74e39d7 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c @@ -760,6 +760,11 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) goto out_release_region; } + if (bfad->pci_bar2_kva == NULL) { + printk(KERN_ERR "Fail to map bar2\n"); + goto out_release_region; + } + bfad->hal_pcidev.pci_slot = PCI_SLOT(pdev->devfn); bfad->hal_pcidev.pci_func = PCI_FUNC(pdev->devfn); bfad->hal_pcidev.pci_bar_kva = bfad->pci_bar0_kva; -- 2.7.4