From patchwork Tue Nov 22 12:35:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 24350 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2178809wrr; Tue, 22 Nov 2022 04:47:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf7WMBXf52aU8ALbCO7NZ7igJ8ewJPb8+9jOmOTFB9/2LfDoWnB0DImTjO/+xsEDUBVkhyeP X-Received: by 2002:a63:d04f:0:b0:46e:c41c:e4bf with SMTP id s15-20020a63d04f000000b0046ec41ce4bfmr4709615pgi.123.1669121267041; Tue, 22 Nov 2022 04:47:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669121267; cv=none; d=google.com; s=arc-20160816; b=Op2fM+2d3X+k3YiCcVpq4SWQHNhFh/Aj2x5cL3WL+GsGIp0ZySGKNZDJWYh+6iMnVl Zt+KLUKv0wQYPrLT3X5MJYGMdMTrh+PjfdCdL9JB1aEhSka23aS+bs4dNH145kKgFvLv 3/rU+IK8RwqhtPPXP0n6w5UanWkGBM+Vilpjx6qlOVaSsXHPZZ2+/6vKiRJwBS1RTaiZ PnpPKLtKOnM+gnItGn7WMfP8ida9vCCnpGf+r8kHW/1T1LIEYwJkWkYXrMLLNvghjYii QLaClXNPGIxe2+XE3JqFS8uuypsWnL6iFvwDCZCLaM5ZpQVh+PM+EoufaJbrfe9Uedzm YXCQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a17090a474700b00213213d63bbsi12374107pjg.41.2022.11.22.04.47.33; Tue, 22 Nov 2022 04:47:47 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750200501377550480?= X-GMAIL-MSGID: =?utf-8?q?1750200501377550480?= 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; }