Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2553953imc; Sat, 23 Feb 2019 06:02:00 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibynf2+TTAAmZV+e+7QA0lQYJC4j+55RfujgFlMDLchTDCyE2dzninQdfJSm+uWWOtyXoKb X-Received: by 2002:aa7:8459:: with SMTP id r25mr6933452pfn.65.1550930520601; Sat, 23 Feb 2019 06:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550930520; cv=none; d=google.com; s=arc-20160816; b=hOeJZ+rAwBrHU3rdvRrsTdcixbYzsavFYlDLXPlqzoxiDnJ9AQFqCQmhc0QHYJpJ60 sKO+DfVqazrRor0Sf01KKoOudY18YwZrAadqSxlz3HiZ13ryRhUR5nq4xQarPxGOz1az xH2Ej1jrCpwKX/XVpULJgWbJihu+Rbqz8k82W/LcbQhB2webHsZ5obIQFPN7tNaBNNy0 KuN2nKEo22Sc/qzXy7UaCn8qyNwhcb4M8Su5JAp/B8fi4RgxYvg+oIgFnoQTmMASKVeh oSUdD0Etspq+NlqeLOzIoDpHQZKCJDaJzz4eQvKXshnD+lln+f+yWnHwcktYIIYQuBji e7vw== 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=NFEvl9XJIOvWo4TXzmfJM63l9FPhhmVARuTwSiQPrA4=; b=hbcbJRHfa2xwpw15UZp7RAHPcyIZ3iBhSgdIUp+LaH9juGfmC1uk52nY2Im1TLjfZv iNIPfZeMHicUX/BrYGl7EVcYRVZJTW/Z2NoRFtdahzB9WbBKxgQ89ec90hEgov6t+DK3 aRJgOAhuXqcjIY3wSEdcLuuOxotPKKE0CrbsDpmbUjpYW8nj3G/aVRG4JMhI4HJfPSCZ dHCEV98WwmRLP1hGRkeykX2vV0YSI7f7qjoRa+qkrAaRDfogELXh/M6CnxpE9Lr89KSL MQhkn6Xuo4nwPFIe2JxHx/YQ4eNQkAHus1fmo/Ox6h7GxoKWCIqsy8OEMdbhm6fExlq7 qW6A== 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 y3si3855264plt.68.2019.02.23.06.01.44; Sat, 23 Feb 2019 06:02:00 -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 S1727955AbfBWN6t (ORCPT + 99 others); Sat, 23 Feb 2019 08:58:49 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:17560 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725859AbfBWN6s (ORCPT ); Sat, 23 Feb 2019 08:58:48 -0500 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609501" Received: from palace.lip6.fr ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 23 Feb 2019 14:58:44 +0100 From: Julia Lawall To: Thierry Reding Cc: kernel-janitors@vger.kernel.org, David Airlie , Daniel Vetter , Jonathan Hunter , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/12] drm/tegra: rgb: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:33 +0100 Message-Id: <1550928043-14889-3-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1550928043-14889-1-git-send-email-Julia.Lawall@lip6.fr> References: <1550928043-14889-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 a tested device node is not available. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ identifier f; local idexpression e; expression x; @@ e = f(...); ... when != of_node_put(e) when != x = e when != e = x when any if (<+...of_device_is_available(e)...+>) { ... when != of_node_put(e) ( return e; | + of_node_put(e); return ...; ) } // Fixes: d8f4a9eda0067 ("drm: Add NVIDIA Tegra20 support") Signed-off-by: Julia Lawall --- drivers/gpu/drm/tegra/rgb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c @@ -221,8 +221,10 @@ int tegra_dc_rgb_probe(struct tegra_dc * int err; np = of_get_child_by_name(dc->dev->of_node, "rgb"); - if (!np || !of_device_is_available(np)) + if (!np || !of_device_is_available(np)) { + of_node_put(np); return -ENODEV; + } rgb = devm_kzalloc(dc->dev, sizeof(*rgb), GFP_KERNEL); if (!rgb)