From patchwork Sat Feb 23 13:20:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10827503 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 90F936C2 for ; Sat, 23 Feb 2019 13:59:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79D412E722 for ; Sat, 23 Feb 2019 13:59:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E41A2E72B; Sat, 23 Feb 2019 13:59:20 +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.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1D0562E722 for ; Sat, 23 Feb 2019 13:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XYUtESKNQG9x62mOK4spSzl4O3DtuWQmdNqi0Oqcjcs=; b=LbOHSkaoIDdH4rEVdrvN+2S4qo yJX9/g9k0gnT6blWJ5UWA3ROyxfQg5hq+c6I7/JTSK8TV0YqSAHyZ+h2+xLRIuD+ADhKyEmwzB46O f5K3AqTlB4l95RkrEYLCeSswZu5/T3TwFJB39rNsx5UH64zzBULQtbkfsSz4bdZvmsaQaIGqbK+ad o9rWQOz8rMKUdeEWW+TKdFDS6c00sjjJ1cEHWU0qmKSbcopzRnNplijC+jyW58Jr4+HBgGkjB/LA4 0kriHVztVTu6Pq4G+3CI4FRUuqd+5qssBPJXFOi8KwIFlfJuNa1C8XZHhiNhDAsPuZvpH/A6DHiie GxcOuTjQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxXpi-0005bS-JB; Sat, 23 Feb 2019 13:59:14 +0000 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxXpS-0005HL-Vj; Sat, 23 Feb 2019 13:59:00 +0000 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609508" 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: Kevin Hilman Subject: [PATCH 09/12] meson-gx-socinfo: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:40 +0100 Message-Id: <1550928043-14889-10-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190223_055859_289591_06E28F59 X-CRM114-Status: UNSURE ( 8.08 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: a9daaba2965e8 ("soc: Add Amlogic SoC Information driver") Signed-off-by: Julia Lawall --- drivers/soc/amlogic/meson-gx-socinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c --- a/drivers/soc/amlogic/meson-gx-socinfo.c +++ b/drivers/soc/amlogic/meson-gx-socinfo.c @@ -123,8 +123,10 @@ static int __init meson_gx_socinfo_init( return -ENODEV; /* check if interface is enabled */ - if (!of_device_is_available(np)) + if (!of_device_is_available(np)) { + of_node_put(np); return -ENODEV; + } /* check if chip-id is available */ if (!of_property_read_bool(np, "amlogic,has-chip-id")) From patchwork Sat Feb 23 13:20:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10827509 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 A0CBC6C2 for ; Sat, 23 Feb 2019 13:59:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFCCF2EA4B for ; Sat, 23 Feb 2019 13:59:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E40542EA53; Sat, 23 Feb 2019 13:59:28 +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.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 91B632EA4B for ; Sat, 23 Feb 2019 13:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=VC8zr70PHzyNkHPD6yyLLqgflIVnxQ9hfGEouMDKwnw=; b=BhiWB0o76jbXmXO/j6xY/fUFz4 Ox/2uODiZbgsGMBZdpzAB++wLslx+d33v8o7NR2s6Xx/teUX6PueBy3LtpO9vBOsGlkbHTh44e1S5 Zx+nyNBYd79RLWk08/7AKy1YGBZpuFKCB/AvEHuoWnotrKdLgMwyXAIwDnU6HrrtlqwjOb4bNnmIv atZnvJcTyPoLyu3xEmbygNB+PG50piQTedefm2wFh7P4PveczMa4YypqDLy5DdcqVcxVf0JAomKlK 4Qhga+t27MjcWE9U4Ri3K1uvjYcC4TGPlgcZDf2VGYwbFNhxjuGs9PAqZHScCdU6GNqGhSK58+GKT r3bryToA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxXpu-0005pR-Ay; Sat, 23 Feb 2019 13:59:26 +0000 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxXpT-0005JM-Sd for linux-arm-kernel@lists.infradead.org; Sat, 23 Feb 2019 13:59:01 +0000 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609509" 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: Jason Cooper Subject: [PATCH 10/12] cpufreq: ap806: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:41 +0100 Message-Id: <1550928043-14889-11-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190223_055900_193717_1D94F349 X-CRM114-Status: UNSURE ( 8.45 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org, Gregory Clement , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Viresh Kumar , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: f525a670533d9 ("cpufreq: ap806: add cpufreq driver for Armada 8K") Signed-off-by: Julia Lawall --- drivers/cpufreq/armada-8k-cpufreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/drivers/cpufreq/armada-8k-cpufreq.c b/drivers/cpufreq/armada-8k-cpufreq.c --- a/drivers/cpufreq/armada-8k-cpufreq.c +++ b/drivers/cpufreq/armada-8k-cpufreq.c @@ -128,8 +128,10 @@ static int __init armada_8k_cpufreq_init struct cpumask cpus; node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock"); - if (!node || !of_device_is_available(node)) + if (!node || !of_device_is_available(node)) { + of_node_put(node); return -ENODEV; + } nb_cpus = num_possible_cpus(); freq_tables = kcalloc(nb_cpus, sizeof(*freq_tables), GFP_KERNEL); From patchwork Sat Feb 23 13:20:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10827519 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 0B76615AC for ; Sat, 23 Feb 2019 13:59:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E96FF2EA53 for ; Sat, 23 Feb 2019 13:59:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDF642EA5A; Sat, 23 Feb 2019 13:59:39 +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.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 91B5E2EA53 for ; Sat, 23 Feb 2019 13:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=czBuDE8h6tx/UZJ7orgqRniCDolWfUYdr5dFw4Nw3lM=; b=hpWZUhkJStsDiOTeqqPYxJpb0u P/1qyRHthRNDl7w2gGVO9Sl+ZMKw47z6fAupSuvArj9/GwbRerO8MazwM/DArGGHHjX/pflAU8frD FP76KNJEY1G9J0bRyneW86tVmDEdTYWl0sUUHTJOHAvIGpJ/Tkx73WErBAUwfM1MyEwv5ssoFaw6K kZnCCGEPfb+eX9hucTNh+IfKFXE9TjOj8hq9gFd530XJZdNYDsXYhJ4GjA1V4jMI6Gvpkt+t5ffAU Nxr5pHEjeC1QrSrhgecwbo10SMngaIY1eQrQYjumL49G8JpPjcmpMxwjaXEtWP5mla6emLsTWk7bd pietUmCA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxXq5-00066K-DA; Sat, 23 Feb 2019 13:59:37 +0000 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxXpV-0005HL-3u for linux-arm-kernel@lists.infradead.org; Sat, 23 Feb 2019 13:59:04 +0000 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609510" 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: Tony Lindgren Subject: [PATCH 11/12] ARM: OMAP2+: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:42 +0100 Message-Id: <1550928043-14889-12-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190223_055901_779611_B7B2315F X-CRM114-Status: UNSURE ( 9.09 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-omap@vger.kernel.org, kernel-janitors@vger.kernel.org, Russell King , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver") Signed-off-by: Julia Lawall --- arch/arm/mach-omap2/display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -250,8 +250,10 @@ static int __init omapdss_init_of(void) if (!node) return 0; - if (!of_device_is_available(node)) + if (!of_device_is_available(node)) { + of_node_put(node); return 0; + } pdev = of_find_device_by_node(node); From patchwork Sat Feb 23 13:20:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10827521 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 4CABA15AC for ; Sat, 23 Feb 2019 13:59:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 367472EA53 for ; Sat, 23 Feb 2019 13:59:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B0122EA5A; Sat, 23 Feb 2019 13:59:51 +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.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DC9652EA53 for ; Sat, 23 Feb 2019 13:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=r+2kXOVIGgITizrZZ4bKvbZofD3i2ctuHFUM1nX3TEI=; b=itIVGVui0Wbo4K0ZEyF8fSBOjw U16nUbddhqAZ0nLRwMP3I2dywesjW6FWLl/rtjcg1zcYX8BxoOYN08U3qZQ9Mdu682DJfTnX2pCJC yfBxcF7rgSscOgDBY7UWo5Jx3+424wubCJ6zo1Mr3DSbblBGWgtEAOig8U8LbNCoSOsmymsmi0djz Uanvz/vVPafbFpniUal5TMOyaXUbJv5RO8+HB4NXTWw4FmhxlMqtzMUFJlOxhNGz86ElJfo/E9QO8 rzg2UzTDbo/zmJbgJ75QD/R+bKDgR6w1WmJZwQvddZSpJfRD2t8MJyNT1J791pIk3p2Jm/hiV6uqH wliEcAZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxXqH-0006MO-CK; Sat, 23 Feb 2019 13:59:49 +0000 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxXpW-0005KJ-4J for linux-arm-kernel@lists.infradead.org; Sat, 23 Feb 2019 13:59:05 +0000 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609511" 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: Mark Rutland Subject: [PATCH 12/12] drivers: firmware: psci: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:43 +0100 Message-Id: <1550928043-14889-13-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190223_055902_890833_9E31EA7F X-CRM114-Status: UNSURE ( 7.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: d09a0011ec0d5 ("drivers: psci: Allow PSCI node to be disabled") Signed-off-by: Julia Lawall Reviewed-by: Mukesh Ojha --- drivers/firmware/psci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/drivers/firmware/psci.c b/drivers/firmware/psci.c --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -677,8 +677,10 @@ int __init psci_dt_init(void) np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np); - if (!np || !of_device_is_available(np)) + if (!np || !of_device_is_available(np)) { + of_node_put(np); return -ENODEV; + } init_fn = (psci_initcall_t)matched_np->data; return init_fn(np);