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: 10827511 X-Patchwork-Delegate: viresh.linux@gmail.com 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 A104D15AC for ; Sat, 23 Feb 2019 13:59:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CB0C2EA53 for ; Sat, 23 Feb 2019 13:59:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FCA42EA5A; Sat, 23 Feb 2019 13:59:34 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F5882EA53 for ; Sat, 23 Feb 2019 13:59:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727883AbfBWN71 (ORCPT ); Sat, 23 Feb 2019 08:59:27 -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 S1727989AbfBWN6w (ORCPT ); Sat, 23 Feb 2019 08:58:52 -0500 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 Cc: kernel-janitors@vger.kernel.org, Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , "Rafael J. Wysocki" , Viresh Kumar , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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);