From patchwork Sat Jul 15 19:40:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 9842471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A17BF60212 for ; Sat, 15 Jul 2017 20:06:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95632285DB for ; Sat, 15 Jul 2017 20:06:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88BC6285FB; Sat, 15 Jul 2017 20:06:00 +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=-6.9 required=2.0 tests=BAYES_00,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 1A996285DB for ; Sat, 15 Jul 2017 20:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751316AbdGOUF7 (ORCPT ); Sat, 15 Jul 2017 16:05:59 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:59820 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751244AbdGOUF6 (ORCPT ); Sat, 15 Jul 2017 16:05:58 -0400 X-IronPort-AV: E=Sophos;i="5.40,365,1496095200"; d="scan'208";a="231633699" Received: from palace.rsr.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA256; 15 Jul 2017 22:05:51 +0200 From: Julia Lawall To: Kukjin Kim Cc: kernel-janitors@vger.kernel.org, Krzysztof Kozlowski , "Rafael J. Wysocki" , Viresh Kumar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: s5pv210: add missing of_node_put Date: Sat, 15 Jul 2017 21:40:53 +0200 Message-Id: <1500147653-31229-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 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 for_each_compatible_node performs an of_node_get on each iteration, so a return from the loop requires an of_node_put. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ local idexpression n; expression e,e1,e2; statement S; iterator i1; iterator name for_each_compatible_node; @@ for_each_compatible_node(n,e1,e2) { ... ( of_node_put(n); | e = n | return n; | i1(...,n,...) S | + of_node_put(n); ? return ...; ) ... } // Signed-off-by: Julia Lawall --- drivers/cpufreq/s5pv210-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) diff -u -p a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -612,6 +612,7 @@ static int s5pv210_cpufreq_probe(struct if (id < 0 || id >= ARRAY_SIZE(dmc_base)) { pr_err("%s: failed to get alias of dmc node '%s'\n", __func__, np->name); + of_node_put(np); return id; } @@ -619,6 +620,7 @@ static int s5pv210_cpufreq_probe(struct if (!dmc_base[id]) { pr_err("%s: failed to map dmc%d registers\n", __func__, id); + of_node_put(np); return -EFAULT; } }