Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp969307yba; Sun, 31 Mar 2019 18:39:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiKV3EadB6TVNyp0o+U+KGoccNseEXJxvGBgVtI98M3MFHPW6YMvA71bmtkC0s7DF0q4nU X-Received: by 2002:aa7:8c84:: with SMTP id p4mr21283546pfd.164.1554082775398; Sun, 31 Mar 2019 18:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554082775; cv=none; d=google.com; s=arc-20160816; b=EiYmEakx8/TTTek3sT1AS0vmg4zD99TmEhg4GFElPP+qwaoLSPlFpm4Vh/nq16NQbT U43QS6eURHAyGt8QIT45sk0bRc0aA6Ej9WEuAZHzNoaU4tURMxxR4skzlxbOeJrPDzE0 CA3WTjxoFzxo2MB5JdLzsasprpkbrIx3TdwMZDW9tlNdAs627ejxP6r7+JOhiiQZMTI+ oTV2aiupGKUcnTSIbs6p9ak1MTjOIy/6rld7vOhqKz5MK4LsoukHrEuKPcugSOojYkD5 j68bLA8ACTb3pQfYrVFH3jAM0aM8kQG+ZUFUFzTBMImVznWk3gHK9EwcMxymnxUoSWlV OEFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=uU8S2RxoaFQ5EmsU8hJKiS4Ne20bJ+Q3XpdM3by2eNE=; b=LmBkwSOK/lL04ulSQVpW0YDQL2cyT/qj8Y8TFo0MWgau6Xt7oRGYfV4xqTSoynjH35 1h38SEETrBFaUbOJrODKP8T0cpG0+PU4UY+PQsVonuYEJwd+LUtDqTZx5PvftXYwT3cb clK/o1rYpJ+y3FzNHMof5h4RIThyZVAKFaS8FHLaeArL9816GMyfCtP3mZjjEBWBpen2 6Lpd5+WljetTz+O/3Z8iVJ8ONwQQHy92Q4vzAvARhUuKMzCiTcvxF1Rgv1cZOQaKDI8i l6zkhPlKmml8Tg6RyUd8MdQzaT/BYnF+gGoAQI9bENcrJrX5i2dOjnxrru6PliXJv99T BGyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2si7358745plt.197.2019.03.31.18.39.19; Sun, 31 Mar 2019 18:39:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731778AbfDABic (ORCPT + 99 others); Sun, 31 Mar 2019 21:38:32 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:32454 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726893AbfDABi3 (ORCPT ); Sun, 31 Mar 2019 21:38:29 -0400 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 85D7E394860774748DDD; Mon, 1 Apr 2019 09:38:27 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x311cLuY061288; Mon, 1 Apr 2019 09:38:21 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019040109382485-7035275 ; Mon, 1 Apr 2019 09:38:24 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Cc: wang.yi59@zte.com.cn, Wen Yang , "Rafael J. Wysocki" , Viresh Kumar , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH 6/7] cpufreq: pmac32: fix possible object reference leak Date: Mon, 1 Apr 2019 09:37:53 +0800 Message-Id: <1554082674-2049-7-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1554082674-2049-1-git-send-email-wen.yang99@zte.com.cn> References: <1554082674-2049-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-04-01 09:38:24, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-04-01 09:38:21, Serialize complete at 2019-04-01 09:38:21 X-MAIL: mse01.zte.com.cn x311cLuY061288 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The call to of_find_node_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./drivers/cpufreq/pmac32-cpufreq.c:557:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function. ./drivers/cpufreq/pmac32-cpufreq.c:569:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function. ./drivers/cpufreq/pmac32-cpufreq.c:598:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 587, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linux-pm@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org --- drivers/cpufreq/pmac32-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c index 52f0d91..9b4ce2e 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -552,6 +552,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); if (volt_gpio_np) voltage_gpio = read_gpio(volt_gpio_np); + of_node_put(volt_gpio_np); if (!voltage_gpio){ pr_err("missing cpu-vcore-select gpio\n"); return 1; @@ -588,6 +589,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode) if (volt_gpio_np) voltage_gpio = read_gpio(volt_gpio_np); + of_node_put(volt_gpio_np); pvr = mfspr(SPRN_PVR); has_cpu_l2lve = !((pvr & 0xf00) == 0x100); -- 2.9.5