Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5796285rwb; Tue, 22 Nov 2022 05:09:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf4uWUcJgL2eN+8t43O7Ls/VUtw0+JffEXg3PqawIT89SPlGYLZ7Wl2JMFFst2rNLt4AFOWO X-Received: by 2002:aa7:8f08:0:b0:56d:4d37:89dc with SMTP id x8-20020aa78f08000000b0056d4d3789dcmr4911995pfr.81.1669122589668; Tue, 22 Nov 2022 05:09:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669122589; cv=none; d=google.com; s=arc-20160816; b=c4M7SOrTWLXkUuNvyyXYBCiTyK/Nx3JMJuNqSXeQMNXfe4holBrMey8YzBv1gyFZtZ mvyzFMxFy5Idy7h6yzFOME/BSDmF2G6KpWfcLefE1KJOuQzGZyy+JvXLlXK4ltqnLJFW yjOuwq4BwvuCPFfy4d1kAAJPZL2+Ju/15wrTC6SBnEeyQzEhZ2rGV2JMFsRwq4gIhJz6 OUC5waoqpfmhcvWLB+dvQgnqPTvlMq3rMhy6NH9vZTpfbeJ66Vt1ZmWu0Qy8NxdmwW4G 2Hu1MPP1oq/uxYhPyV1vb+4Zw5sRHgaIx+E4tWBt/E9RDggAN5eF2M2Pqa3BQx5rqYvz RhxQ== 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=c4BqBt8PX4+/5esJdkkQ0lMCGexWIZayJPcXuhNmuaA=; b=ZJ+TdTeKobMeHmrtbv/at7Tskzc5Zj145/rmdy6vEKz42H5RXZOdCminflRztpYCnV 35p23eGZSpkoQUs99wttnC7H48WTxBpNhzRFlk3EAIeotIzbXiBArtwtFRAm1DEHxP/j ejHpWSh9Ddl69+shzeajBUutE6ZXXs/oeRH1HGHKleOhYdqEWtB9unngb4pbrq0WVf8K xNM4IOHDcEOCYQoCccpO+2UQ+9MF4KT7BdEiF+90RPWSo39dkd3qaGGenuvHu65pcSXK uPMqcQcG0osSer9reXVQ+c94AbawzNahl+jPjWLk4qEmHEKLXyGFJYZy593ZK/F0MEqJ FeaQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a170902e94f00b00186a2274386si14585089pll.469.2022.11.22.05.09.37; Tue, 22 Nov 2022 05:09:49 -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 S232569AbiKVMtn (ORCPT + 90 others); Tue, 22 Nov 2022 07:49:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231487AbiKVMtl (ORCPT ); Tue, 22 Nov 2022 07:49:41 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83A26606AB; Tue, 22 Nov 2022 04:49:40 -0800 (PST) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NGkbL2hcyzHw4C; Tue, 22 Nov 2022 20:49:02 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.58) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 20:49:38 +0800 From: Xiu Jianfeng To: , , , , , CC: , , Subject: [PATCH -next] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_driver_probe() Date: Tue, 22 Nov 2022 20:46:27 +0800 Message-ID: <20221122124627.174403-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.174.58] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500023.china.huawei.com (7.185.36.114) 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 If devm_clk_hw_register() fails, clk_init.name should be freed before return error, otherwise will cause memory leak issue, fix it. Fixes: 84063a1cbe9e ("cpufreq: qcom-hw: Add CPU clock provider support") Signed-off-by: Xiu Jianfeng --- 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 1bd1e9ae5308..340fed35e45d 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -723,6 +723,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) ret = devm_clk_hw_register(dev, &data->cpu_clk); if (ret < 0) { dev_err(dev, "Failed to register clock %d: %d\n", i, ret); + kfree(clk_init.name); return ret; } -- 2.17.1