Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5788058rwb; Tue, 22 Nov 2022 05:04:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf4OHCLSraHhytJ0q6lbBYrPxQRMZwMaGCkixYLfw1SNEDsxLvzDsN9OaIdRtOJZ02zJJC1t X-Received: by 2002:a63:e4a:0:b0:477:6cd0:9a04 with SMTP id 10-20020a630e4a000000b004776cd09a04mr9246098pgo.433.1669122273676; Tue, 22 Nov 2022 05:04:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669122273; cv=none; d=google.com; s=arc-20160816; b=x9XVRAZrm5bycgPXVSVAbI7D/gVzth0J5S6v8lvKNdUPROKEHfi/69PJh2BxHO11sH /vn+Ekmvsm6cB/yrT/qdx2mcjLB8vsyqC1bO0tjIi3xrUEOOqNKW5imUsB5LGx0pSnKv U9QW6I9Hz2yc1b1Z1Mcuqq9ppsuKUi1n/njpSHejaZT0BihED+LZ02TwDIKiTwPBvyXv tnt1OPC0qaZoLlXxcvPv+SsPW1iw/WBKxVmZjlrOOnqC9VB+prYenZdjhnHtpFfnmpOs vSrNI7jUinMpHcVXbpcys8syPcH5eWTskYepZExorv4k77o2gohrbqqv7FAw+FPS/0so w0uQ== 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=JXQ1c6rbbdLdFn317h+25ibvj9e9OL8TxgzYHeOKhBYDadprBTUc9qGg0yizaxRqUe ayK6Gov0+1/DHC+pef9BGWJVF0biqdCv2M0qw1Z1dRhs1Et7gg3kPxOl7PqjYglhbKl7 V6qdkQXOiKtgRllzB/hee5iKu5muVw1Qvlur0WnTfVmdu/abRyuVV+/FcGrlPyQ/Pylt YTHpFcA+9pZhxOXn99FSX8UB7FoOvb9+ISGeRrx5pqf90ASviIAIdOYSEkRSfqd5Fh2h hAFi/7HkglO9LCcrWTzOk4Xiw/SK5I0ay5veHyoDHTe68qcujyovpDTbQWf+dmUs731d Urhw== 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 i6-20020a170902c94600b001891b503d1asi7126898pla.455.2022.11.22.05.04.18; Tue, 22 Nov 2022 05:04:33 -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 S232871AbiKVMi5 (ORCPT + 91 others); Tue, 22 Nov 2022 07:38:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233831AbiKVMig (ORCPT ); Tue, 22 Nov 2022 07:38:36 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E684758BCE; Tue, 22 Nov 2022 04:38:22 -0800 (PST) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NGkGS1vMSzqSX5; Tue, 22 Nov 2022 20:34:24 +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:38:18 +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:35:14 +0800 Message-ID: <20221122123514.172459-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: dggems705-chm.china.huawei.com (10.3.19.182) 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