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: 9842477 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 930E560212 for ; Sat, 15 Jul 2017 20:06:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86946285DB for ; Sat, 15 Jul 2017 20:06:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B478285FB; Sat, 15 Jul 2017 20:06: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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 E0861285DB for ; Sat, 15 Jul 2017 20:06:27 +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: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:In-Reply-To: References:List-Owner; bh=5rLsbiJ6iCOGkKez7j1qlnio5EXEUA2guh49pIKPt24=; b=TQN fcnzx0you09DCgxz84LX/at0ssBelxCof8760SbciljBvZerpIXVs/8FNYUT43J6AoqXLGSGuJ9fJ WVe7obnQuCVUsr526DeKT+Au8KJxuv4mWl5xrQx5GCpV0ksMwBExQUMamdkREkZ7ZJogionRvb/fR SZ3eMUoyEA8k3bB0GApLMTh7FIRNvFdxMRTvyrvz3LABJaxS031PuBNp8DReo7qlcTw/cziYacBGc RxMGKxuj9KsQC9a/Hhulj67pHqLHIpdOndGqVf1PR145mYNMD9mQnBcIljKcYWUvuqZorkjqKoA7d nXx+cr24zPE4caNjARiUK8SuOJSHJog==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dWTKZ-000498-Px; Sat, 15 Jul 2017 20:06:23 +0000 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dWTKU-00044P-SB for linux-arm-kernel@lists.infradead.org; Sat, 15 Jul 2017 20:06:21 +0000 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170715_130619_217312_920A40DF X-CRM114-Status: UNSURE ( 9.96 ) 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-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Viresh Kumar , 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 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; } }