Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1126938img; Fri, 22 Mar 2019 16:36:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQZALMxMb9Wlb+rTORRGYO4a5RJGaVEqL0FmqWeRyVcxb20zsR6T4WUJ12u6N4283jBUIW X-Received: by 2002:a17:902:a612:: with SMTP id u18mr12093063plq.145.1553297768010; Fri, 22 Mar 2019 16:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553297768; cv=none; d=google.com; s=arc-20160816; b=qcHT+vAnvIQOC4HuTuTtFeT85GsCmiyXA1rbuWMU9ldBexrvCDcvDbhfG/7p0YRH+o q6vyK7gzwjB662fJTlMt7K/1mhcJLUWz1hSwOcVjl0hRJItB/h6MP+hZbknp0oxSPwTU QNsU8C7Jo9m72TXdG8QyWwN/uPT6rjzuCfzDD5XBWTetWiMLNhg7jOF5fKPViT/8XqOd ddRfro+JqHZKfvo4PoHdj7MPiYRrvJAGa2wEWwcIxRr9ttQkkVzPFnGcPTfYv8tFaRw7 V130y4WcqfNRZJx6QpKhg7io55Q4aVmW0UAQqdY7bDIvIYgdlu6TMtfe/adUfacBLVpJ DDqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=Pz3k3VFjfrP+H+qI4o/Lbk9wmyaCTN5DIP4wqYlO92k=; b=ozVX386biU/RXTleYEzft5Ivd+oViCYT7wW52Q5A84slMVldSKezDtOhsG/g4+YOnx xCoKhPMAuAkARI7GZg95vXGgBxButaSzsOPwtmI3AJHwwOdg16WjHnUVuYJ5gwrDB+xg cOZQ/KHsnzf8QtWe0q4ST9h8rRh8B52pNkmPiprn5dwjfYw+xP6a9rd0FEvnyYq6iTdf w+MQtBrYoK/1+vCRt+9agrl9IgDWnVK5hUK0tRXdn40MwZtLlJp7UGNFbio0znTLvXcL yQbfrZ6Mo4/zmVSaqwRluYOE1DdnzWmHOuVtpJ9D/a/gWPY60sb2l44rlCi+M5UN+dmS JJUg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2si1462590pgh.356.2019.03.22.16.35.52; Fri, 22 Mar 2019 16:36:07 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728051AbfCVXfR (ORCPT + 99 others); Fri, 22 Mar 2019 19:35:17 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44208 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726910AbfCVXfQ (ORCPT ); Fri, 22 Mar 2019 19:35:16 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2MNSvGf100250 for ; Fri, 22 Mar 2019 19:35:14 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rd788v1rx-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 22 Mar 2019 19:35:14 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Mar 2019 23:35:12 -0000 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 22 Mar 2019 23:35:11 -0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2MNZBqJ15204400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Mar 2019 23:35:11 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B841112062; Fri, 22 Mar 2019 23:35:11 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F764112064; Fri, 22 Mar 2019 23:35:11 +0000 (GMT) Received: from linux-xej6.aus.stglabs.ibm.com (unknown [9.40.195.184]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 22 Mar 2019 23:35:10 +0000 (GMT) From: Tyrel Datwyler To: bhelgaas@google.com Cc: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Tyrel Datwyler Subject: [PATCH 2/2] pci: rpaphp: get/put device node reference during slot alloc/dealloc Date: Fri, 22 Mar 2019 13:27:22 -0500 X-Mailer: git-send-email 2.12.3 In-Reply-To: <20190322182722.8255-1-tyreld@linux.vnet.ibm.com> References: <20190322182722.8255-1-tyreld@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19032223-0040-0000-0000-000004D62239 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010797; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000282; SDB=6.01178238; UDB=6.00606765; IPR=6.00958937; MB=3.00026118; MTD=3.00000008; XFM=3.00000015; UTC=2019-03-22 23:35:12 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19032223-0041-0000-0000-000008E1407A Message-Id: <20190322182722.8255-2-tyreld@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-22_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=773 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903220167 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When allocating the slot structure we store a pointer to the associated device_node. We really should be incrementing the reference count, so add an of_node_get() during slot alloc and an of_node_put() during slot dealloc. Signed-off-by: Tyrel Datwyler --- drivers/pci/hotplug/rpaphp_slot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index 5282aa3e33c5..93b4a945c55d 100644 --- a/drivers/pci/hotplug/rpaphp_slot.c +++ b/drivers/pci/hotplug/rpaphp_slot.c @@ -21,6 +21,7 @@ /* free up the memory used by a slot */ void dealloc_slot_struct(struct slot *slot) { + of_node_put(slot->dn); kfree(slot->name); kfree(slot); } @@ -36,7 +37,7 @@ struct slot *alloc_slot_struct(struct device_node *dn, slot->name = kstrdup(drc_name, GFP_KERNEL); if (!slot->name) goto error_slot; - slot->dn = dn; + slot->dn = of_node_get(dn); slot->index = drc_index; slot->power_domain = power_domain; slot->hotplug_slot.ops = &rpaphp_hotplug_slot_ops; -- 2.12.3