Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2868594imc; Wed, 13 Mar 2019 03:25:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwrjTxNHubM2fcwKzHCOUcYSZonKoJ0xcFa9+QkpB9/Ez0FU0+j3ENQxyuW5zRtepPTyeco X-Received: by 2002:a17:902:be02:: with SMTP id r2mr45547255pls.209.1552472745658; Wed, 13 Mar 2019 03:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552472745; cv=none; d=google.com; s=arc-20160816; b=O4CVhQUEfTJBz//XK6Vi67Hh6kpphvm2zrvAoscOyAZgABe8l1X93d8Rx4wC3m0dJL 6G36L/rifKGbbGltEsqaxGi/eCCcctGa84i8HCc8Qj7rDAIh8VVRE+sUPeVD3cd+YkxM 5SpOVm4tk7UXaNe7BBbbYx6oWzMK8pQemAEdPPNMVRTmwyQLUFh1VLPNqjN+Rh02zWOk hkpfhXmFHoJRP+C6U4vDXc1i3MTGfJMjHr2eLgwZfquBdx2/73JialtHTFtUMClp/FJk rgGcSHIDWQSaOO+8Y2y9sLZcIFzmA/WP/jzwUclhaTVL5B8Sew5lZF+wixjSPr4sxDTb NlDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=xH8ohzx4rRsUg0baIbn2MdIC5VPSi/1K5vohqq3RYgY=; b=fDt5KAi3QDQLw0aX0O5bQ9m21NOaBjvAo/Y9jRZYX15KfJd0mj4uumTEle20iD14wz ooGaXXAblhn5tvFHWymsHUWYZFRxQKLgk8Z3roN5eV/ImoO1fsAR19abeSlT6b0Ci1GK 9d3oidyOrr9hE22e+XQo52mQWaI934WBG9/F1WjHMfJWS2wExPR2OEz5Rv21e1riePip SMd36PQhoyIdw3XHOTuUY55Pfbes8c9JJEifWe+QhDMZ8O+ptJ4p12eY7FoJq8MnpY2z zM9JC9crYnWhD6MSxg6+egmHmMvIiSlwEhd1/deXEwhYFfxWPJXF/w1BEVkF8Pu+wRfb EObg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=f+kPSHf3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n19si9836512pff.18.2019.03.13.03.25.29; Wed, 13 Mar 2019 03:25:45 -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=pass header.i=@synopsys.com header.s=mail header.b=f+kPSHf3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726292AbfCMKY7 (ORCPT + 99 others); Wed, 13 Mar 2019 06:24:59 -0400 Received: from smtprelay.synopsys.com ([198.182.60.111]:35664 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725847AbfCMKY6 (ORCPT ); Wed, 13 Mar 2019 06:24:58 -0400 Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 9027D10C260A; Wed, 13 Mar 2019 03:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1552472698; bh=mWkOJrm3USsacYgpgtGi/hc2CEa983PNQAMWVQbNTrc=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=f+kPSHf372nBogRZlnB6AmBwWyODzJALAe2sDnH8mknRHt1OFPOOJK1SRhN1DA9m0 Kr/Jq4WIAiqYw09D9A9/AJajIhF6GzF6TyuQIzsMFU46rRgVRJPJgXLilR7wFqGgZ/ xBMz8u5k5vmC3jSAzv5mPofZ3ebd7xc/5NUuBmZh6HGOFZZuJCM5Uv1gimfKz6c0G2 InDEBjVIsl1YaNt13KLjLEwqB6iMjzT9LRAKWuIMJTBAahprlRAsVjZtcpsp0QRP5M K8cSNTPGN6/7FLfbIYNSuZ6tD8IJFa1Vp1aHCr1SxZDGraAmUNPXmSuM3pH8CWf/Zw uEQpbAmCA9Gtw== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 7A3EDA005D; Wed, 13 Mar 2019 10:24:58 +0000 (UTC) Received: from DE02WEHTCB.internal.synopsys.com (10.225.19.94) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 13 Mar 2019 03:24:58 -0700 Received: from DE02WEHTCA.internal.synopsys.com (10.225.19.92) by DE02WEHTCB.internal.synopsys.com (10.225.19.94) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 13 Mar 2019 11:24:56 +0100 Received: from [10.107.19.55] (10.107.19.55) by DE02WEHTCA.internal.synopsys.com (10.225.19.80) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 13 Mar 2019 11:24:56 +0100 Subject: Re: [PATCH v2 3/5] PCI: dwc: Free MSI in the error code path of dw_pcie_host_init() To: Jisheng Zhang , Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas CC: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" References: <20190301125510.4e2ee985@xhacker.debian> <20190301125818.1b0d7e08@xhacker.debian> From: Gustavo Pimentel Message-ID: Date: Wed, 13 Mar 2019 10:24:54 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190301125818.1b0d7e08@xhacker.debian> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.107.19.55] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 01/03/2019 05:05, Jisheng Zhang wrote: > If we ever did some msi related initializations, we need to call > dw_pcie_free_msi() in the error code path. > > Signed-off-by: Jisheng Zhang > --- > drivers/pci/controller/dwc/pcie-designware-host.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > index abe3ff5f0867..66569d0f3ab9 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > @@ -482,7 +482,7 @@ int dw_pcie_host_init(struct pcie_port *pp) > if (pp->ops->host_init) { > ret = pp->ops->host_init(pp); > if (ret) > - goto error; > + goto err_free_msi; > } > > pp->root_bus_nr = pp->busn->start; > @@ -496,7 +496,7 @@ int dw_pcie_host_init(struct pcie_port *pp) > > ret = pci_scan_root_bus_bridge(bridge); > if (ret) > - goto error; > + goto err_free_msi; > > bus = bridge->bus; > > @@ -512,6 +512,9 @@ int dw_pcie_host_init(struct pcie_port *pp) > pci_bus_add_devices(bus); > return 0; > > +err_free_msi: > + if (IS_ENABLED(CONFIG_PCI_MSI) && !pp->ops->msi_host_init) Look to Lucas Stach patch 3afc8299f39a ("PCI: dwc: skip MSI init if MSIs have been explicitly disabled") You need to change this to: if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled() && !pp->ops->msi_host_init) > + dw_pcie_free_msi(pp); > error: > pci_free_host_bridge(bridge); > return ret; > Sounds good, thanks. Acked-by: Gustavo Pimentel