From patchwork Mon Jun 27 05:50:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 70894 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp904606qgy; Sun, 26 Jun 2016 22:57:27 -0700 (PDT) X-Received: by 10.98.69.81 with SMTP id s78mr30092575pfa.63.1467007047114; Sun, 26 Jun 2016 22:57:27 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si24530280pfj.166.2016.06.26.22.57.26; Sun, 26 Jun 2016 22:57:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751196AbcF0F5U (ORCPT + 14 others); Mon, 27 Jun 2016 01:57:20 -0400 Received: from condef008-v.nifty.com ([210.131.4.245]:33520 "EHLO condef008-v.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750851AbcF0F5U (ORCPT ); Mon, 27 Jun 2016 01:57:20 -0400 X-Greylist: delayed 350 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 Jun 2016 01:57:19 EDT Received: from conuserg-09.nifty.com ([10.26.8.72])by condef008-v.nifty.com with ESMTP id u5R5ndgU014761 for ; Mon, 27 Jun 2016 14:49:39 +0900 Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id u5R5nE5B026359; Mon, 27 Jun 2016 14:49:15 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com u5R5nE5B026359 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1467006555; bh=mGEMXHWWjoDVTcvlNP2FfIe+jl+UdgvzBcwQjMdfuPw=; h=From:To:Cc:Subject:Date:From; b=icpdbnrmhrrIZXe7DTBSXt7s1wJI2tIPNQqAaO5Tr/eZE+wt96G9HJpsP0PCmQTZ+ rZ/R9SNTZnJAl2fK8ffr1S/MSaz+qW5G9+lkXCUxabTRZ2k6dAYE1Sjd/zkKun7sK1 ThE5He0OyROdt6fiEAlKmDMsLV1TZdK7nSfPdBavW0wH8pyF1vSaTYN5iMmESd1CMP Kg5ej8LYKx//lxcI4HiNvFt5u/3ZYVAoxYy5PMnRxVXBPuB8FGVze37tiAiPhd9z2o n7RBcAVSwXHqAkzZJDVQylYsBU0EGKMniu1d8pm9f5zRUpY2hYoAtFpu56SRah+Cv3 XVQszuQPswBWQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-pm@vger.kernel.org Cc: Viresh Kumar , Masahiro Yamada , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH] cpufreq: dt: call of_node_put() before error out Date: Mon, 27 Jun 2016 14:50:13 +0900 Message-Id: <1467006613-24076-1-git-send-email-yamada.masahiro@socionext.com> 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 If of_match_node() fails, this init function bails out without calling of_node_put(). I also changed of_node_put(of_root) to of_node_put(np); both of them hold the same pointer, but it seems better to call of_node_put() against the node returned by of_find_node_by_path(). Signed-off-by: Masahiro Yamada --- drivers/cpufreq/cpufreq-dt-platdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c index 3646b14..0bb44d5 100644 --- a/drivers/cpufreq/cpufreq-dt-platdev.c +++ b/drivers/cpufreq/cpufreq-dt-platdev.c @@ -79,15 +79,16 @@ static const struct of_device_id machines[] __initconst = { static int __init cpufreq_dt_platdev_init(void) { struct device_node *np = of_find_node_by_path("/"); + const struct of_device_id *match; if (!np) return -ENODEV; - if (!of_match_node(machines, np)) + match = of_match_node(machines, np); + of_node_put(np); + if (!match) return -ENODEV; - of_node_put(of_root); - return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1, NULL, 0)); }