Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2452638imu; Sun, 13 Jan 2019 02:24:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN5rFCFY7QdXm3wML6KHZLR/FpZXIDFTRWBbEdfMxeHU3RzDnDE02+bAgLnyA8nbuNYDsRoN X-Received: by 2002:a62:7e13:: with SMTP id z19mr21136186pfc.94.1547375084302; Sun, 13 Jan 2019 02:24:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547375084; cv=none; d=google.com; s=arc-20160816; b=figGHEy6dEg7eKGvE4D6wFPIxy2roeqZOljUukSWaclKGaSCQIcILt88bf4ruIU572 qk/ER164DnmZSsdC7HOUEop7VCqIHn/wgl2fkl6t2vzmoK/KVDT9NAdYoSzW3uvg7Ekp rXexcf/weAYeiz0SNExk21xNHnxNHQuOvwcQMDSnJcqtiexz0+GezHJgcy2wNvrczrjq V9igefpk3ickEkeom9i1iVjsom741NFhQfYP5abKsBsaXuLQv3alHVCa1CHp9ohbd/Dh cK3K93D/dSEh14WsPbkNL8MxhimW+PkzuE5mGj8TuDKM5r9xIKDqGFHG07qVNj3cYS8K GY9A== 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=tsbaMXw+bdBrUFK/hfgd+1+afUca+kBejIvrsWHeoZ4=; b=y6Ih+RzASQBAvXm7xZeNBiGyRFavXxH/xc1fTAoU9UIOwqKrqTYbyPN9MVsEn2J03C Kr0ysuIJddaL1zVVCq7DJ5c577DIFkShCdXCXdzC0DCqz1BRKslQEAwB528LEbfSW5Dn vIEuD98v5UWlA+fqzAJVjWRHjL5FzYM9XxPL8uVu+qMVY66Yy1W0yeuUQcEo86uyvuBa m7mKiTKgvLp/+52LDGJbz6y8rHgSs9/4erwUNh+tzHpyXQUFjiLK/kV27tMqlKyO06mA Uz68vpTtOPuMvJAwUxnXdyEDLcjffomPXuXBM8Ef1BhjAIIkOYQjIouAmYoApIg0BD/Y 00BA== 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 h19si4540856plr.67.2019.01.13.02.24.25; Sun, 13 Jan 2019 02:24:44 -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 S1726765AbfAMKWK (ORCPT + 99 others); Sun, 13 Jan 2019 05:22:10 -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 S1725875AbfAMKWA (ORCPT ); Sun, 13 Jan 2019 05:22:00 -0500 X-IronPort-AV: E=Sophos;i="5.56,473,1539640800"; d="scan'208";a="291728765" 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: Neil Armstrong Cc: kernel-janitors@vger.kernel.org, David Airlie , Daniel Vetter , Kevin Hilman , dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] drm/meson: add missing of_node_put Date: Sun, 13 Jan 2019 10:44:51 +0100 Message-Id: <1547372691-28324-4-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. An of_node_put is also needed when meson_probe_remote completes. This was present at the recursive call, but not in the call from meson_drv_probe. 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/gpu/drm/meson/meson_drv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 3ee4d4a4e..b59c757 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev, remote_node = of_graph_get_remote_port_parent(ep); if (!remote_node || remote_node == parent || /* Ignore parent endpoint */ - !of_device_is_available(remote_node)) + !of_device_is_available(remote_node)) { + of_node_put(remote_node); continue; + } count += meson_probe_remote(pdev, match, remote, remote_node); @@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev) for_each_endpoint_of_node(np, ep) { remote = of_graph_get_remote_port_parent(ep); - if (!remote || !of_device_is_available(remote)) + if (!remote || !of_device_is_available(remote)) { + of_node_put(remote); continue; + } count += meson_probe_remote(pdev, &match, np, remote); + of_node_put(remote); } if (count && !match)