From patchwork Tue Nov 8 07:23:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Hui X-Patchwork-Id: 16889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2528019wru; Mon, 7 Nov 2022 22:55:12 -0800 (PST) X-Google-Smtp-Source: AMsMyM4ToJrPJy6hjtJuVZaNEUz2I0qvMGQ9iPdB9kPxG5LO9z1KCDsikFL3VcCiMgImFT0jsl6T X-Received: by 2002:a63:2d86:0:b0:438:6d6d:70b8 with SMTP id t128-20020a632d86000000b004386d6d70b8mr960635pgt.16.1667890511957; Mon, 07 Nov 2022 22:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667890511; cv=none; d=google.com; s=arc-20160816; b=dl//dM1jNpQ6RzYPUtJmgQXJTm1KmtcdWAIKu/xDW0RXo5JCpcapvuapDmNXGXC69g 5E5YfFWyj6uJ2dW2lQRPdLVd5BzbWyvtnWybkecpBotzzO0IktJ921FaiASazru9gMGA SlXv9sNM1bJ9gpdKQ/mQrM3qjfT4xXI1EnmyiETD+aObcic6SzTj3l8dJDNyq9WxmRXu Jq8b4XalL4d+i6I8VyLyfOeVYeYF55LQgajHIlwzdoQEQzhgEl0SkFQEKMl5iHMZY8U6 SU5h0vWhNq1GHVWpw1W0uTbJmZTiIYwzDLfcKJb/wXObA87w+CnUnzUP8xWDm3re+y6l JLNA== 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=9U8V+bDMaJloqkoVq3iJ1dXjhsNLKqVQ9KajG/HK66o=; b=AfUsKcRglTgRFOPuueD848+dbCyWtcbUY+3UJ27jTzFpZEXTNDzSD8ZkDJNtb26iio fBWh4ct/hJlsfjwWN10WZ/Z3Cc8YAh4LfytMJrdvfrfitsU3iKYWR/VlRpLxjqlujVw6 VAEaKhiroGfnDJhRsEImNmSQZYt7poXJSCK0PjUbL8IoiTZ8aOTRA/XRFlo2dNBdyAHZ 4BSvJ5igqLtXVWvXmUARxA1xiq+RUxtrf6j8nGiV3f+Lec7wZ1lHy2U6jpOfacYfWPds 7d7p3Mkcd8bYp+bcqSIZg+ts9OAdW7ChwGYn0wuOKHBYTlC/FFBFw9SHdzUX9656JH4l Jz9Q== 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 s21-20020a63e815000000b00434dd6f6e21si13021415pgh.125.2022.11.07.22.54.58; Mon, 07 Nov 2022 22:55:11 -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 S229478AbiKHGyQ (ORCPT + 99 others); Tue, 8 Nov 2022 01:54:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbiKHGyP (ORCPT ); Tue, 8 Nov 2022 01:54:15 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86B41FCC4; Mon, 7 Nov 2022 22:54:13 -0800 (PST) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N5zJ83CWFzpVxg; Tue, 8 Nov 2022 14:50:32 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggpemm500021.china.huawei.com (7.185.36.109) 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 14:54:11 +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 14:54:11 +0800 From: Chen Hui To: , , , , , , CC: , , , Chen Hui Subject: [PATCH] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_read_lut() Date: Tue, 8 Nov 2022 15:23:02 +0800 Message-ID: <20221108072302.736-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: dggems706-chm.china.huawei.com (10.3.19.183) 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?1748909961855800961?= X-GMAIL-MSGID: =?utf-8?q?1748909961855800961?= If "cpu_dev" fails to get opp table in qcom_cpufreq_hw_read_lut(), the program will return, resulting in "table" resource is not released. Fixes: 51c843cf77bb ("cpufreq: qcom: Update the bandwidth levels on frequency change") Signed-off-by: Chen Hui Reviewed-by: Sibi Sankar --- drivers/cpufreq/qcom-cpufreq-hw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 833589bc95e4..d15097549e8c 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -193,6 +193,7 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev, } } else if (ret != -ENODEV) { dev_err(cpu_dev, "Invalid opp table in device tree\n"); + kfree(table); return ret; } else { policy->fast_switch_possible = true;