Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp687664ybb; Thu, 28 Mar 2019 10:10:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxqSSA+fb9kYsz12zfcyEUGwES3wvMAbe1WYDxpnWo0hA2PRl25m3hNJ3v/D+OTOsNwCDmf X-Received: by 2002:a17:902:6942:: with SMTP id k2mr44390073plt.136.1553793056945; Thu, 28 Mar 2019 10:10:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553793056; cv=none; d=google.com; s=arc-20160816; b=VEsjfWCny8BdDu3DhGEofWPoV0UuGfDDvm/lZkynGYdEZWQt2tuzUpo7JvMHaZMn9L cJskzVov3A2CR8k5qz5sSYlzVy80GA+Kj6KTqL5JtV8sCeBKk0JwqNSqhlAHkyAxrI6U 1OmWSQTZh07NNM3A8S6J5r/9RbgqD25e4VFgbNEgMFfoslnOxaDiGX6dU1cqDfZAdCRG ZXBrdqu2aPbNQ7Fq/E0nSbOE6z1y9L2oTF+Vq+dOXKyKXGjhfv1X0KkI6tFDEgP3gjec dzE7RJeHqmLhIMvTG/CymBQ9AcyxLqCaG6xetq7M/2De5wffdpq4owrhb+3s5wMS6Mr+ L0Ig== 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; bh=t6fYhDISkRlVsUsYHuVzavo7WjndxSNhSyAFqtSkGSM=; b=ZhYsggMYfCzmeGmas305s6cyONSW4e3vdUmAndkHM/XvcVq+N27hp1FTuTaLttw+8W MlXAnZTqtcsr6zBuORg15XC/EzinTTc7BmL2coK02M5NkXHL4d2C6CO6a+6FlJn9ZWPn 9SGOYbI1oxVVJOgso6ZniEekPpeenC0y1nzdjiujg7ZPOmRwMIhQO9Qw8S2T0XglbFFV gsJGEsNmWV2foxFdpviKcBmERpR8KOt4Qxsskq79phBsDnr186yYTIiunENfSblnY7nC YVGr+tQ0k3lojnE6QrAucjnlOZUeU0X6YPySo9QtP5oEbIc0aavWkJOm+93j7YYiNdgE 7iHg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si22197193plo.33.2019.03.28.10.10.41; Thu, 28 Mar 2019 10:10:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727149AbfC1RIr (ORCPT + 99 others); Thu, 28 Mar 2019 13:08:47 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:48670 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbfC1RIq (ORCPT ); Thu, 28 Mar 2019 13:08:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 31BFE80D; Thu, 28 Mar 2019 10:08:46 -0700 (PDT) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C766A3F557; Thu, 28 Mar 2019 10:08:44 -0700 (PDT) Subject: Re: [PATCH v3 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: <20190318174415.74fd25a5@xhacker.debian> <20190318174841.522fb6fd@xhacker.debian> From: Robin Murphy Message-ID: <689f8a0f-ba79-da80-d0e3-24ef6814a9aa@arm.com> Date: Thu, 28 Mar 2019 17:08:43 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190318174841.522fb6fd@xhacker.debian> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/03/2019 09:56, 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 > Acked-by: Gustavo Pimentel > --- > drivers/pci/controller/dwc/pcie-designware-host.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c > index a71b874ae3c0..585080699675 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-host.c > +++ b/drivers/pci/controller/dwc/pcie-designware-host.c > @@ -483,7 +483,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; > @@ -497,7 +497,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; > > @@ -513,6 +513,10 @@ 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) && pci_msi_enabled() && pci_msi_enabled() already has a stub for !CONFIG_PCI_MSI, so you shouldn't need an explicit IS_ENABLED() here. Robin. > + !pp->ops->msi_host_init) > + dw_pcie_free_msi(pp); > error: > pci_free_host_bridge(bridge); > return ret; >