Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3323026imm; Sun, 14 Oct 2018 17:29:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV63SelDfLYQbJDQAl8bTiglTZCZZkmc1Kn7H9F2rC4TjsxQ/kwkUpaVD9YGH41tnwwcvHTeU X-Received: by 2002:a62:2606:: with SMTP id m6-v6mr15266055pfm.104.1539563349445; Sun, 14 Oct 2018 17:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539563349; cv=none; d=google.com; s=arc-20160816; b=XaoyMD+5jH8g9zodVbqLUsuLGJRFabDeoALdgHvTMBwVMZUeEEWtGSQMmoO5O8kBwB vMRAQAtk41oS2bh+teP1vAp/ROsTA/Nj4K+bAtl9Bjsf3nEXGG/r/Wl0z9Tpx2fhjdCT 1wunM+BrmVwEpw2KMKlBzcfFhKZcgKr1MJuk88gTJsBxc+Er8O7OH+5LjcR6q7hYX5Kf 74Ek6HvaHk2+l+nkFAu/iJkhaaM36Rfa/i5/MIF0Mi0eyP3p9k40ROyGh2Ka7AeUk68e ajyx0mabyf7RJ7jO8k5LRDUbE6GZnkCu6yZZ4lXty4tQfcIQ+1TlAyUJx9BS2m9uHJVU t+DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=LkfoWFcm35ZeWsmFJr143DG24LEUdEKPjd4pwB8vYwk=; b=pcZqwM38I2GSl5KxMG1XxGNXsQu/jH9PqrlYZPNe69izUz5dYTZJrEFouFsrEU3am9 nv2Xp8i9b2v1i56Lh5X7EWhP9QP2d/RfzfKa6GeNDCZoA8G2PLUZsV13raxpOSuKGCzR X8Jz/3W4+Oi98qnQK3ak2xa0AlbP28Lz3H3FkiErynIp4hjGVYOPz7+5c5/VNEYFV0W7 3KKtNsj1UC1tzRETCWAX69386QV2Qupcvu7fYDdLy/GV7P+s1tGxjFS9YyNxZRp3pLcV AX2wya/g6Vb7aD7guq4+UOpNNx6SMw2eUEytBF8C3voPxYhLDetY+R+rW+EADxa+kuw9 5qOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Uzv6Yjjx; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3-v6si8025631pga.500.2018.10.14.17.28.55; Sun, 14 Oct 2018 17:29:09 -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=@gmail.com header.s=20161025 header.b=Uzv6Yjjx; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726597AbeJOIIw (ORCPT + 99 others); Mon, 15 Oct 2018 04:08:52 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37593 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726541AbeJOIIw (ORCPT ); Mon, 15 Oct 2018 04:08:52 -0400 Received: by mail-pg1-f194.google.com with SMTP id c10-v6so8302731pgq.4; Sun, 14 Oct 2018 17:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LkfoWFcm35ZeWsmFJr143DG24LEUdEKPjd4pwB8vYwk=; b=Uzv6YjjxexlLzpyU+vjvP21HgRYfNv92lYn/zG7KSH2fGoP3pgfyjAjHPzNdVF3LPg SNve7sEbcEVMTRbSGO+4c3Dmq8fR9CthPMJw9tFMUVzBo2d+JqcpJfMaT/TRyrNgvfN+ CiPUaOHBdAPQAWhZsGI6XHFk6hhnVG6egN3bM7LS3r7pvPM9srLgW4HURs8AgrJsP+tO /6qTvoisEioyMFau2UAhuL4mTmZfJ9n1zDrKGiADiPT8y0c7khGZwWvZke44vh847DAF 3gARD4Tl8o/no2EyXjTKUkJG953PpXqY7EUngcm08NTM36fMim5OWWskPrpPTBJbuQYy ACNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LkfoWFcm35ZeWsmFJr143DG24LEUdEKPjd4pwB8vYwk=; b=ChenuvCo8suufmXKb8Rq4ceXu5Jlf+GSwimKVqASr8hd7e65XQXA/ASYKzZpopTlb0 2WZXooN1MxjdEx44GGQ6cFLiQ/Kcn1e31hToQiEqip9j/JIvkSHLwZ7WQRcR1Nbn/8ar Zh4lZp2QzxHG+e6aH8ffvwZXDcWnDR2tmH3HCVK48nrF52BgNT6Kbl0y5x0AY3roFGjS fDxJN0PU/XMmxGFuwacJz6NuvEGOw0oOuSREURPd0edF3A2lYBesH6nvbDypjWoIRioP l7ZRPXBIlphXZuQZ2gRClYHbIgKIklDYnMmjvcvqH5O5b6ECAECpZkHyu/OTGz43KVZO uD4g== X-Gm-Message-State: ABuFfohWO9j50VVPAZL1BS3WevWoFPCTcQts9UaYeNwEantmQjE6nhbd 7RG2s/ktidJnL0lsFMS18co= X-Received: by 2002:a65:664e:: with SMTP id z14-v6mr13542613pgv.347.1539563163410; Sun, 14 Oct 2018 17:26:03 -0700 (PDT) Received: from localhost.localdomain (c-24-6-192-50.hsd1.ca.comcast.net. [24.6.192.50]) by smtp.gmail.com with ESMTPSA id j14-v6sm11387110pgh.52.2018.10.14.17.26.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Oct 2018 17:26:02 -0700 (PDT) From: frowand.list@gmail.com To: Rob Herring , Pantelis Antoniou , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Alan Tull , Moritz Fischer Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, linux-fpga@vger.kernel.org Subject: [PATCH v3 03/18] of: overlay: add missing of_node_get() in __of_attach_node_sysfs Date: Sun, 14 Oct 2018 17:24:15 -0700 Message-Id: <1539563070-12969-4-git-send-email-frowand.list@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539563070-12969-1-git-send-email-frowand.list@gmail.com> References: <1539563070-12969-1-git-send-email-frowand.list@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frank Rowand There is a matching of_node_put() in __of_detach_node_sysfs() Remove misleading comment from function header comment for of_detach_node(). This patch may result in memory leaks from code that directly calls the dynamic node add and delete functions directly instead of using changesets. Signed-off-by: Frank Rowand --- drivers/of/dynamic.c | 3 --- drivers/of/kobj.c | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index b04ee021a891..275c0d7e2268 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -272,9 +272,6 @@ void __of_detach_node(struct device_node *np) /** * of_detach_node() - "Unplug" a node from the device tree. - * - * The caller must hold a reference to the node. The memory associated with - * the node is not freed until its refcount goes to zero. */ int of_detach_node(struct device_node *np) { diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c index 7a0a18980b98..c72eef988041 100644 --- a/drivers/of/kobj.c +++ b/drivers/of/kobj.c @@ -133,6 +133,9 @@ int __of_attach_node_sysfs(struct device_node *np) } if (!name) return -ENOMEM; + + of_node_get(np); + rc = kobject_add(&np->kobj, parent, "%s", name); kfree(name); if (rc) @@ -159,6 +162,5 @@ void __of_detach_node_sysfs(struct device_node *np) kobject_del(&np->kobj); } - /* finally remove the kobj_init ref */ of_node_put(np); } -- Frank Rowand