From patchwork Fri Aug 10 09:08:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 176429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 986FF2C0095 for ; Fri, 10 Aug 2012 19:10:49 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758067Ab2HJJKs (ORCPT ); Fri, 10 Aug 2012 05:10:48 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:35076 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758012Ab2HJJKr (ORCPT ); Fri, 10 Aug 2012 05:10:47 -0400 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id ANH48395; Fri, 10 Aug 2012 17:10:41 +0800 (CST) Received: from SZXEML414-HUB.china.huawei.com (10.82.67.153) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.1.323.3; Fri, 10 Aug 2012 17:09:43 +0800 Received: from localhost (10.135.69.25) by SZXEML414-HUB.china.huawei.com (10.82.67.153) with Microsoft SMTP Server id 14.1.323.3; Fri, 10 Aug 2012 17:09:37 +0800 From: Hanjun Guo To: Eric Moore , CC: Bjorn Helgaas , Yinghai Lu , Taku Izumi , Yijing Wang , Hanjun Guo , Jiang Liu Subject: [RFC PATCH] Fusion MPT: disable pci device when mpt map resoures failed Date: Fri, 10 Aug 2012 17:08:42 +0800 Message-ID: <1344589722-8772-1-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.10.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.135.69.25] X-CFilter-Loop: Reflected Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org when probe a pci device, first we enable it, and disable it when some error happened in the following process, because the power state of the device is set to D0, and if MSI is disabled, we will allocate irq and register gsi for this device in the enable process. In function mpt_mapresources(MPT_ADAPTER *ioc), it forgot disable the pci device when error happened, the irq and gsi will never be released. this patch will fix it. Signed-off-by: Hanjun Guo Signed-off-by: Jiang Liu --- drivers/message/fusion/mptbase.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index d99db56..fb69baa 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -1666,7 +1666,7 @@ mpt_mapresources(MPT_ADAPTER *ioc) if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) { printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with " "MEM failed\n", ioc->name); - return r; + goto out_pci_disable_device; } if (sizeof(dma_addr_t) > 4) { @@ -1690,8 +1690,7 @@ mpt_mapresources(MPT_ADAPTER *ioc) } else { printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", ioc->name, pci_name(pdev)); - pci_release_selected_regions(pdev, ioc->bars); - return r; + goto out_pci_release_region; } } else { if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) @@ -1704,8 +1703,7 @@ mpt_mapresources(MPT_ADAPTER *ioc) } else { printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", ioc->name, pci_name(pdev)); - pci_release_selected_regions(pdev, ioc->bars); - return r; + goto out_pci_release_region; } } @@ -1735,8 +1733,8 @@ mpt_mapresources(MPT_ADAPTER *ioc) if (mem == NULL) { printk(MYIOC_s_ERR_FMT ": ERROR - Unable to map adapter" " memory!\n", ioc->name); - pci_release_selected_regions(pdev, ioc->bars); - return -EINVAL; + r = -EINVAL; + goto out_pci_release_region; } ioc->memmap = mem; dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %llx\n", @@ -1750,6 +1748,12 @@ mpt_mapresources(MPT_ADAPTER *ioc) ioc->pio_chip = (SYSIF_REGS __iomem *)port; return 0; + +out_pci_release_region: + pci_release_selected_regions(pdev, ioc->bars); +out_pci_disable_device: + pci_disable_device(pdev); + return r; } /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/