Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1242113imm; Wed, 23 May 2018 12:39:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoAygUxIHsu+InRuoUEzhaZ6xOuJ/qxrKM3lCmFQhWDhtK7ziSWXL5y4/9mQBREKcpwyVPk X-Received: by 2002:a17:902:6bca:: with SMTP id m10-v6mr4234654plt.6.1527104378760; Wed, 23 May 2018 12:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527104378; cv=none; d=google.com; s=arc-20160816; b=DFJBXEQzdLeDC42m96ap2EIWYXfI5YKA80koGzvtlIlGKXzIVEj99fS4MocZrYKq2C CWX35LQOtMl2ltAGKY+7OWCYtQ6ZaMQKQf3kGc6Zc4l4XbSADpsEHaJ20C4KKmAS89HF 3caIrv8uJRhpAtuIGvZGxBwnM8UI03jgKuN0WrlvYzBQQ0azuPA5s6bRCXeUjFoLoNsH 3iZAcAm7KOeXe+R93ckyE/KZ136HGoQeAdiCer+rCP5C+wMGFg9cCPMwjHhU/Kfryy11 zbppvj8wuOHl4cULgaKEOZg1Cg7o+tRuj3bcW+lAv9txDjTnQkK6S4oos9jCkHKgAuj8 Ph8Q== 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:arc-authentication-results; bh=VhZWcCP2B1YI50PJziYOjrM9ORvLc2Cr/+d+STFjgUg=; b=m3sg7xEUHSWv049vJTcUJS3eh18q6LN+6TtvuBIcUG+iDf++P6AfvQg8Bjay0KlWfl fIK8XPZbC+Ng5FOGDb2hMWCEgWGefi7kMLGkgRh9thV6YZedS1WNuQxN1Buk3jhklLUg IvkTZK76MMQD7iImvQK0TGqE12A1gdGFJZW0TkQp55FPE8Y5Pyw8My7mrLCc2LBYj1sV VJDef5/cm7FGyf9NzA5OR4mWxTGln5+v3VF4B1YRTIUPz88irjQT0tkFJd7AFMhzZIJl mrB8j4FPbLfHGHHAP3nHGE390ROTmft/Dhn2v25TBSXH/YHs2/ecYnfMRIjba7cBV6lb C4Ag== 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 b96-v6si19726595pli.172.2018.05.23.12.39.23; Wed, 23 May 2018 12:39:38 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934719AbeEWTjK (ORCPT + 99 others); Wed, 23 May 2018 15:39:10 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:13790 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934316AbeEWTjD (ORCPT ); Wed, 23 May 2018 15:39:03 -0400 X-IronPort-AV: E=Sophos;i="5.49,434,1520895600"; d="scan'208";a="328129394" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 23 May 2018 21:38:58 +0200 From: Julia Lawall To: Sandy Huang Cc: kernel-janitors@vger.kernel.org, =?UTF-8?q?Heiko=20St=C3=BCbner?= , David Airlie , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] drm/rockchip: lvds: add missing of_node_put Date: Wed, 23 May 2018 21:07:16 +0200 Message-Id: <1527102436-13447-6-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527102436-13447-1-git-send-email-Julia.Lawall@lip6.fr> References: <1527102436-13447-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 The device node iterators perform an of_node_get on each iteration, so a jump out of the loop requires an of_node_put. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ expression root,e; local idexpression child; iterator name for_each_child_of_node; @@ for_each_child_of_node(root, child) { ... when != of_node_put(child) when != e = child + of_node_put(child); ? break; ... } ... when != child // Signed-off-by: Julia Lawall --- drivers/gpu/drm/rockchip/rockchip_lvds.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c index e67f4ea..051b8be 100644 --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c @@ -363,8 +363,10 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, of_property_read_u32(endpoint, "reg", &endpoint_id); ret = drm_of_find_panel_or_bridge(dev->of_node, 1, endpoint_id, &lvds->panel, &lvds->bridge); - if (!ret) + if (!ret) { + of_node_put(endpoint); break; + } } if (!child_count) { DRM_DEV_ERROR(dev, "lvds port does not have any children\n");