From patchwork Sat Feb 23 13:20:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10827533 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 502511575 for ; Sat, 23 Feb 2019 14:08:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B800C1FFBE for ; Sat, 23 Feb 2019 14:08:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7B4620121; Sat, 23 Feb 2019 14:08:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 465591FFBE for ; Sat, 23 Feb 2019 14:08:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D2AC898AA; Sat, 23 Feb 2019 14:08:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 142ED89780 for ; Sat, 23 Feb 2019 14:08:50 +0000 (UTC) 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 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> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jonathan Hunter , linux-tegra@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Mukesh Ojha --- 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)