Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2463361imu; Sun, 13 Jan 2019 02:42:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN4UwHTzrC1DKWOe0JfjXDsmbXnJtcDdOr4jE9RihHcbOwySzPVTj3GBqH2ZDwHjebG5h3E+ X-Received: by 2002:a17:902:7443:: with SMTP id e3mr21432285plt.304.1547376125777; Sun, 13 Jan 2019 02:42:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547376125; cv=none; d=google.com; s=arc-20160816; b=wrZ5u+wunl7xbXWdWj9l3kIQEEulB+cxAMr22JjYcqOnMpKkJ1RW+IT2nXWhWzxZm9 QQ8IbRdHsZV+vlVDvgwXyykrYQzbgRR2HondTyHtgqKr2HRnWSAppXUBzW7oQxEjCQzh bx/v548RLZGMHzbeqHJCwWLplyknbSDW/8fuhd5K2nnhvVLCJPlRsYNgm62YL8dIWQT1 a9TSX3TovDHdWaAAk/eu+MqvMIQbYONnX6GVqxwD/P0yt7MJiu12MNEJrQ6LRxFaQ+X7 DSUOrTx5F7pebY5KfDGB2UnSyBmM+4DlbQiCDK7CDY9YSWvM7X0Zbv9ZkdfFSPvwOOhS gT/g== 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; bh=JoiUTCQ4V5kRYyVZDh2qX6BGaTZvXEOjWMZxzLhkkt8=; b=DhjG47WFocYM2LFKIgLP/IqNlZgUrPTT8GS2KxUlH2IwBgJPTMHGVvDXF9p+dN98gK rySrKrqPHInJ44rk4PChSm7/mJicDo5pmQVsKBUVenKQdapNB5jqAkEOCgZQiLsJyWvE +YxGu7IiCMfKTlX0jycZIN0fV//3ef1cQAINgM8xziMyDVnMZr3BHIUbgAGAodWaHGZA NsgnsrQPJuz7lCh0Zsy4DXkaVJBVB91EUAUJqnZk2TWphQakAkjyujAWcuUYwVZhAi6e 3Vn5iwR634/u1H+Lo1WkhB2JWogDnbIboLcLiCkyDyAcNtpvDfDgOhF3xVHaTnLs/36f Dw1A== 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 q15si23503786pgm.420.2019.01.13.02.41.34; Sun, 13 Jan 2019 02:42:05 -0800 (PST) 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 S1726705AbfAMKWA (ORCPT + 99 others); Sun, 13 Jan 2019 05:22:00 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:47959 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726665AbfAMKV6 (ORCPT ); Sun, 13 Jan 2019 05:21:58 -0500 X-IronPort-AV: E=Sophos;i="5.56,473,1539640800"; d="scan'208";a="291728764" Received: from palace.lip6.fr ([132.227.105.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA256; 13 Jan 2019 11:21:54 +0100 From: Julia Lawall To: Rob Herring Cc: kernel-janitors@vger.kernel.org, Frank Rowand , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] OF: properties: add missing of_node_put Date: Sun, 13 Jan 2019 10:44:50 +0100 Message-Id: <1547372691-28324-3-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1547372691-28324-1-git-send-email-Julia.Lawall@lip6.fr> References: <1547372691-28324-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an of_node_put when the result of of_graph_get_remote_port_parent is not available. The semantic match that finds this problem is as follows (http://coccinelle.lip6.fr): // @r exists@ local idexpression e; expression x; @@ e = of_graph_get_remote_port_parent(...); ... when != x = e when != true e == NULL when != of_node_put(e) when != of_fwnode_handle(e) ( return e; | *return ...; ) // Signed-off-by: Julia Lawall --- drivers/of/property.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 0843003..8631efa 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -806,6 +806,7 @@ struct device_node *of_graph_get_remote_node(const struct device_node *node, if (!of_device_is_available(remote)) { pr_debug("not available for remote node\n"); + of_node_put(remote); return NULL; }