From patchwork Tue Nov 8 14:12:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Hui X-Patchwork-Id: 17045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2713917wru; Tue, 8 Nov 2022 05:44:19 -0800 (PST) X-Google-Smtp-Source: AMsMyM4mP7yVdQ6AI+rcgiiSyGp7SnGTp5J4U0MOW5cSLthzZbfRX1UlFHTNIlD5mOc9UQbOztGe X-Received: by 2002:a17:902:f214:b0:186:b065:eedb with SMTP id m20-20020a170902f21400b00186b065eedbmr54810564plc.45.1667915058893; Tue, 08 Nov 2022 05:44:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667915058; cv=none; d=google.com; s=arc-20160816; b=Su+NBo8hH0tXo1QLO4ySYBbOXHT1WqDhzzoJEYRbXBGgTNwJCvEM+kYbjHG3wwimCs 1QsSHfyZz1sCDTov9WVKRq5bJwISQ1TitRpxfm0sUu/kk0gU1k4BUmQvKH4WrVxZrTUe YBld8EOsO83sRJXPKRWD/yU6BAROzmZLObXpRy1yYC2oc/jVtSKWCn9svNYkI3VakARa qU0LxFwOhUFJkDg4r8nbdyeT02QHTwlbA5eTEAlv2eNKaMTI5YMnZrqAPEJdg1pwbXNC LEGtdcWU6V0lkNQlgVW70DujZFAiRgRO3PWcer8ie7ew5QApuX8bC4Z/50YHIbfd2TJ7 rDDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=ePsrrqYsyEzem9saCH85a+HYgf0lFJXPQQn2uAWp/h0=; b=HFsyKnLGs5y5z+iH7TFebMOwW5hl4/s86KWlQ06DjVHNc/unrx47J4DFLWBfOIQyK8 u860GDd3c/S6YHMWnDMx99FFSmhc793jMvhtqBeRSz6RMuyg25WISwwljpBazkBExVAh QnJUWnNRV55fCDzn3TnRYFjyqbzkONALekfbqPq8aDfFkIVYkch+pDW6SM5hutdGxX/B 5kLLBaZKqT4VzM1J+ufGWhnXqXsiQnp3VmxcPj/zdgsuyoduvcpvzpRIaHRdN6lpCPy3 qyo2zIWtfn3J8UH0JulgeSb3g/gLd+c3twCPKubJHiEBCLUvDne/6yuD9En42odFOZRR 0BKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a170902cac400b00186a3bc939esi11923521pld.211.2022.11.08.05.44.04; Tue, 08 Nov 2022 05:44:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234479AbiKHNnz (ORCPT + 99 others); Tue, 8 Nov 2022 08:43:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234323AbiKHNnv (ORCPT ); Tue, 8 Nov 2022 08:43:51 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BEEF12751 for ; Tue, 8 Nov 2022 05:43:50 -0800 (PST) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4N68PW4N4jzHqLF; Tue, 8 Nov 2022 21:40:47 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 8 Nov 2022 21:43:47 +0800 Received: from huawei.com (10.67.174.191) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 8 Nov 2022 21:43:47 +0800 From: Chen Hui To: , CC: , , Subject: [PATCH] arch: arc: Fix memory leak in show_cpuinfo() Date: Tue, 8 Nov 2022 22:12:41 +0800 Message-ID: <20221108141241.42007-1-judy.chenhui@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.191] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748935700723241636?= X-GMAIL-MSGID: =?utf-8?q?1748935700723241636?= The "cpu_clk" resource is malloced by clk_get(), it is not released when the function return. Fixes: 7f35144cea21 ("ARC: get rate from clk driver instead of reading device tree") Signed-off-by: Chen Hui --- arch/arc/kernel/setup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index 41f07b3e594e..9457c7ad8707 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c @@ -637,6 +637,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) cpu_id); } else { freq = clk_get_rate(cpu_clk); + clk_put(cpu_clk); } if (freq) seq_printf(m, "CPU speed\t: %lu.%02lu Mhz\n",