Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp131820ybz; Tue, 28 Apr 2020 20:02:01 -0700 (PDT) X-Google-Smtp-Source: APiQypL7We56yU50AjfGHB2n8LfNBQo+EWajh+avWNRFVcxv41X/iocXi7loWKk+no4aUZY2AkYw X-Received: by 2002:a50:e8c1:: with SMTP id l1mr681334edn.81.1588129321860; Tue, 28 Apr 2020 20:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588129321; cv=none; d=google.com; s=arc-20160816; b=BILChLCHfJyiMIdEziERaldKfSw8PpHmuRVCvIH0foX3kGiKZfHcOTdYY9DuLgNAD7 lSbFOuRKTTApBbSbzn9qfTOst4rfxt2Fb8S7XVnCA38ZP5NZTDqi/fer0V1FGnC0ydlC AcrLsASHwZUs7tFMwNqmwHzcH2vh8Gi65uNTdo1TnpOw7u1d4iHUoX0kdSFQop5WsodX FnQ/re50YhCZNj/j+WkCEC5m5yURTOAR5nfYVgHH0/Exm2aCmumy0hF4ZFxowY6KNt20 sp972icKeSXhGNZtW4e+PZrIl89sqjYMVdL29GBZGJad8T68pORKNFc9NrWDaB4Hy5nq JP5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=i4LREGf/UpvRImJRM39VrJ/L4cSv7TBK4kcjG5/2DoI=; b=hfDY6k8OARdHS/yfGa/Azhrs19D62aRwLz0480frlYV9GPhr/LuL8TTO7ohQrkuQty cMKbZlkTm8cBKTvQXY5s58Yu0ZpgHG3V+V16DY69sMpRSQEiir/f5oUbHTVbDduJFfa1 yHHENyESpuClhFejJtiGgrv22gBJBt7Kt0pBQrZELLjP3W9qhiwMnDcpQWVCb2MuyyYQ ZfXyxdFMNBoZnbWoIiHmjAf2NM9KEaq09vomGM8vIxuus+tJBP5UUyGmpPcrhgzoGO5R OqG3eC10tc/PllIel4zjU3SHElYdPHXBJDf+GJofne071W1Iaq7YokBdilpm71OjR3yz ChKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si3003563eja.226.2020.04.28.20.01.37; Tue, 28 Apr 2020 20:02:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726620AbgD2C61 (ORCPT + 99 others); Tue, 28 Apr 2020 22:58:27 -0400 Received: from inva020.nxp.com ([92.121.34.13]:32902 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726522AbgD2C60 (ORCPT ); Tue, 28 Apr 2020 22:58:26 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id ECFD31A021F; Wed, 29 Apr 2020 04:58:24 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 616281A01F8; Wed, 29 Apr 2020 04:58:20 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 419B74032C; Wed, 29 Apr 2020 10:58:09 +0800 (SGT) From: Anson Huang To: rui.zhang@intel.com, daniel.lezcano@linaro.org, amit.kucheria@verdurent.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH V3] thermal: imx: Add missing of_node_put() Date: Wed, 29 Apr 2020 10:49:30 +0800 Message-Id: <1588128570-12917-1-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After finishing using cpu node got from of_get_cpu_node(), of_node_put() needs to be called, the cpufreq policy also needs to be put unconditionally. Signed-off-by: Anson Huang --- Changes since V2: - call cpufreq_cpu_put() unconditionally after cooling register done. --- drivers/thermal/imx_thermal.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index e761c9b..8764cb5 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -649,7 +649,7 @@ MODULE_DEVICE_TABLE(of, of_imx_thermal_match); static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data) { struct device_node *np; - int ret; + int ret = 0; data->policy = cpufreq_cpu_get(0); if (!data->policy) { @@ -661,20 +661,19 @@ static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data) if (!np || !of_find_property(np, "#cooling-cells", NULL)) { data->cdev = cpufreq_cooling_register(data->policy); - if (IS_ERR(data->cdev)) { + if (IS_ERR(data->cdev)) ret = PTR_ERR(data->cdev); - cpufreq_cpu_put(data->policy); - return ret; - } } - return 0; + cpufreq_cpu_put(data->policy); + of_node_put(np); + + return ret; } static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data) { cpufreq_cooling_unregister(data->cdev); - cpufreq_cpu_put(data->policy); } #else -- 2.7.4