Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3370526pxb; Fri, 5 Nov 2021 14:37:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyt+8ho0fey6Xt8ym2xjtpKBdqNMo5t0GM2f86AD0PSg+vRscEBMT1enKStlK1n3huILxi X-Received: by 2002:a05:6e02:1a69:: with SMTP id w9mr31863525ilv.312.1636148223079; Fri, 05 Nov 2021 14:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636148223; cv=none; d=google.com; s=arc-20160816; b=lun2/zsNr217NXaN0uE96wGi34bigwcDD3uG8gpuKJNha4zFv4wJ7BlJQRoqPvoAof e6YLxqfYdTsKTC5qylTzQ8oypKzY4/yoNhy1qVkCu8tONlx3a2JrHnRdxXl2+CQ/nQu2 6PTE5SM8EE/sSF+GhYsBu/bKOLzgHtW/uIBc3XRqsf/RirL+aJue9PoQVHjkjaPd64k+ KO0WneWx/khAs8XK+FZgOvuY3Z9cYiZa1u3k9Q3tiL6svX7fltm9RWG3iD45XMKKGo9h 3H8pTqQ2QOYoWbIdafp4Kf5IPqPZNNct3GWfWM43yplFGYsfuP6hgeqlnXn6QBDoN1ed l3kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=jbeZmAEmgHJYj8U6GGuyQzqJRXeIq4/AIRYoofmx76w=; b=vo44P6sNdsHnexfNvJGoy9uJLpz9wMkS07tc7FvzDp8cGT+dgh1AybADFSVXn4WJZg JQSgYwGXuPABFD+n7cXniM+FRsHGAQQskVJnKcZH5EgZfN/BYcVrQDwP1sg+KjF44dW1 HSgR19T2IG2IlkWrvnGdOz6s2+jT4FnmBOZt+DBWIxaeEp4OyE1QKxniXRfKpX7KG6b/ d7VjPreV3oPJv/9IS9NmgAQs8D8Innrwh+QyJ67CkCR7gVIAaJBehNy7A6z4Qbzd+/3I LEHK71uMhoMVVKv+e+DDpKqsVrQS4zP8SB8+L+lqL8xqVllD4YELcvL62lMTwOfOMV/t CgEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=t7+aYOcS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si21450281ill.11.2021.11.05.14.36.48; Fri, 05 Nov 2021 14:37:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=t7+aYOcS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232934AbhKETCe (ORCPT + 99 others); Fri, 5 Nov 2021 15:02:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:60300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230318AbhKETCc (ORCPT ); Fri, 5 Nov 2021 15:02:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45763604AC; Fri, 5 Nov 2021 18:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636138792; bh=1NO8uQVnvgttsvTHkhigZrBgaijDJw1yYma8oHwx2PM=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=t7+aYOcSWjBzHqiFD4sjFu00H4+pqtXUJli3LpUs/mxwhGm2x4oPf8ypHbgIWR4AO um60uauslNvnpqSVK0IgYmi2NlSCPCRliUyodIYEveoIICS17D8gB/LpAr3YZntfem AQAuMpJCRTIjvH4/Z1U2Zjc0MVaktl/wUTL6O4VhjPiOtP166V9vKrZPmWj0zjV1Sm KdWwtJ6Ax0lmxoXUshqIgsomzgTxv53jm2jHdfYXMnnZwHG0qNmXiWiIgL2N0/Gj0s Bis+PKRLs88hG3jvL1AzKXNS0bXd/AzHfcTRPii3GtoSBJCyOHzMI4f3ciHmmq4AWL vsdhLfqitfJjw== Date: Fri, 5 Nov 2021 13:59:50 -0500 From: Bjorn Helgaas To: Wan Jiabing Cc: Xiaowei Song , Binghui Wang , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, jiabing.wan@qq.com, mchehab+huawei@kernel.org Subject: Re: [PATCH v2] PCI: kirin: Fix of_node_put() issue in pcie-kirin Message-ID: <20211105185950.GA938070@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211105020711.32572-1-wanjiabing@vivo.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 04, 2021 at 10:07:11PM -0400, Wan Jiabing wrote: > Fix following coccicheck warning: > ./drivers/pci/controller/dwc/pcie-kirin.c:414:2-34: WARNING: Function > for_each_available_child_of_node should have of_node_put() before return. > > Early exits from for_each_available_child_of_node should decrement the > node reference counter. Replace return by goto here and add a missing > of_node_put for parent. > > Signed-off-by: Wan Jiabing I had already squashed this into: https://git.kernel.org/cgit/linux/kernel/git/helgaas/pci.git/commit/?id=b22dbbb24571 > --- > drivers/pci/controller/dwc/pcie-kirin.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c > index 06017e826832..b72a12bac49d 100644 > --- a/drivers/pci/controller/dwc/pcie-kirin.c > +++ b/drivers/pci/controller/dwc/pcie-kirin.c > @@ -422,7 +422,8 @@ static int kirin_pcie_parse_port(struct kirin_pcie *pcie, > pcie->num_slots++; > if (pcie->num_slots > MAX_PCI_SLOTS) { > dev_err(dev, "Too many PCI slots!\n"); > - return -EINVAL; > + ret = -EINVAL; > + goto put_node; > } > > ret = of_pci_get_devfn(child); > @@ -446,6 +447,7 @@ static int kirin_pcie_parse_port(struct kirin_pcie *pcie, > return 0; > > put_node: > + of_node_put(parent); > of_node_put(child); > return ret; > } > -- > 2.20.1 >