Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1694331pxb; Wed, 20 Oct 2021 09:56:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeYvm5EzFYEoAqH+7veZB2FdMdelbbz1xHrRz2L1Cofu3o7GMKTU9ytkSmGP4/ygc0CaUh X-Received: by 2002:a05:6402:34d1:: with SMTP id w17mr82627edc.383.1634748982444; Wed, 20 Oct 2021 09:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634748982; cv=none; d=google.com; s=arc-20160816; b=znSvT5MbzG5Fv1lQE/t/B0dq/LQf3FYn/DVELUvvGxgmmM/jMwepD1nIkua88mP5uV 4HNtiyxtPCd1ZpxQq7C7ZGP3fWLRHsjJRECDzF6S1VWGimhygF7EBGevwp/ZuLzVip3d XRLXTGfDgniGLMjDNROtOU7sUysLV1rNOf2qy6ezi3GVJGOd5zusc8np8zSeeZU5GSH1 WtxpCTs5StU2Ng1tpMkCBa8zsUyTyuAPBmPn0zcdT0YNWoiE0d+Sku9Fi+PqTBtE6Ngo s40MwNp6pJyyNMIUjDbig1XLT70Y3Ng3Yn6GxQBXuTtBEsYgdmHmXIXHSdeJgfp10jiP QbfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=8vwQcs16z4jwCBgDoO7eJaU97CZS5frolOclDq5kwQM=; b=wU5AVgIml1w4a24VokeqU2ujPDE/U5PWxyx/zK0U9FZDgcBMsy95zcU/vFOiE1sebJ +VqNWIuG6vecoPEuAyV4yITtmfy5axCAmJ5gUL+3ciO1VomtBf9JRMF2YTqfES0BzhUo U/mz9mLQpJ8AZbQIH0yGYax/rqeCMs1qCgsfYped746iQnhCyi02EuEWMIp9u6atGU2u hXeqas0168ohrtDJP7vUwyzSLu26pwHBvJMbfRYplsAXjC58e5bfcz0Cwhbu45AXsSSf UnOkTJJKGtXrF+ZftzmftSMhrCF9nwww2kvqOrK8o+h+UzX2m1OJdLSSIPlr4mfZiedd wMnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=cYPs5ja+; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z27si3880553edm.505.2021.10.20.09.55.57; Wed, 20 Oct 2021 09:56:22 -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=@ibm.com header.s=pp1 header.b=cYPs5ja+; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230439AbhJTQ4M (ORCPT + 99 others); Wed, 20 Oct 2021 12:56:12 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:64182 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230073AbhJTQ4K (ORCPT ); Wed, 20 Oct 2021 12:56:10 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19KGpfnw032728; Wed, 20 Oct 2021 12:53:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=8vwQcs16z4jwCBgDoO7eJaU97CZS5frolOclDq5kwQM=; b=cYPs5ja+2VgjGYzn9ST0U9QAW5pCsQuNmNOngZGHFDwtj2lS/Ggi+ro16xxl8ANuM8WR SmcH7QDh7G1OlGwW6jKA/A0SEZkcmgPzmT9YxLw6XW9ibrMsaBqZuQKMBNQL7n+Mg4uN LHrVBZbczbZ+kJC+AMfClnxN5myNvpKDXKyPZ0OdWYW4XJ/wtFpmxdb7JJsWWWZv3YSg ZaolDyPtLclqnwy7Zp+/T/0Ym6fJ+1zI7w7RUofq8CIht2O4x04IP3/5udgEruZcVDn+ eDHXhp81NiwSmoR9gKPB2nEJbYAdNO9UD4jVWGFW4o+3IdTR1m1YzzLnEu8retw+yDGr iw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3btpdqgvyc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Oct 2021 12:53:36 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19KGpnEb001224; Wed, 20 Oct 2021 12:53:35 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 3btpdqgvy4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Oct 2021 12:53:35 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19KGm6cD001505; Wed, 20 Oct 2021 16:53:34 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma05wdc.us.ibm.com with ESMTP id 3bqpcc9n3r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Oct 2021 16:53:34 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19KGrXlJ19530108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Oct 2021 16:53:33 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DDF28C605A; Wed, 20 Oct 2021 16:53:33 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35DBAC6065; Wed, 20 Oct 2021 16:53:32 +0000 (GMT) Received: from oc6857751186.ibm.com (unknown [9.65.235.71]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 20 Oct 2021 16:53:31 +0000 (GMT) Subject: Re: [PATCH] PCI/hotplug: Remove unneeded of_node_put() in pnv_php To: Wan Jiabing , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Bjorn Helgaas , linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kael_w@yeah.net References: <20211020094604.2106-1-wanjiabing@vivo.com> From: Tyrel Datwyler Message-ID: Date: Wed, 20 Oct 2021 09:53:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211020094604.2106-1-wanjiabing@vivo.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: PeiGYbWmp4jpmLz3O0PIf88tPxZfXwoU X-Proofpoint-GUID: j5Tlcj0sjCBZ5VtaMprbvFchCNc5RVHl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-20_05,2021-10-20_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 mlxscore=0 spamscore=0 clxscore=1011 priorityscore=1501 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 bulkscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110200092 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/20/21 2:46 AM, Wan Jiabing wrote: > Fix following coccicheck warning: > ./drivers/pci/hotplug/pnv_php.c:161:2-13: ERROR: probable double put. > > Device node iterators put the previous value of the index variable, so > an explicit put causes a double put. > > Signed-off-by: Wan Jiabing NACK This is a false positive from coccicheck. This is a case were a node is being dynamically removed and the long reference needs to be dropped. Otherwise, the reference count doesn't go to zero and trigger cleanup. This would result in us ending up in a leaked device node. -Tyrel > --- > drivers/pci/hotplug/pnv_php.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c > index f4c2e6e01be0..f3da4f95d73f 100644 > --- a/drivers/pci/hotplug/pnv_php.c > +++ b/drivers/pci/hotplug/pnv_php.c > @@ -158,7 +158,6 @@ static void pnv_php_detach_device_nodes(struct device_node *parent) > for_each_child_of_node(parent, dn) { > pnv_php_detach_device_nodes(dn); > > - of_node_put(dn); > of_detach_node(dn); > } > } >