Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5818173rwb; Tue, 22 Nov 2022 05:26:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf6waT+uCmvptqxhIUyV5853Kr4z8Zo6nPQXnUGyXG+MRaf2mWOfzrBRVYXhzX2dTXwwhwIP X-Received: by 2002:a17:906:6a0c:b0:7ad:9f03:aa46 with SMTP id qw12-20020a1709066a0c00b007ad9f03aa46mr3777579ejc.175.1669123565344; Tue, 22 Nov 2022 05:26:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669123565; cv=none; d=google.com; s=arc-20160816; b=OnUp6OJvpeYUqyW2+DYaBRQozrIB3xxtQvi6oMxT0hYjPWY/5fYtfBzi8bFygKqT0D XuRwtM+pNGcgj1cucD4SX9nUGoFz7+DVUTr3D5xkjnaBj99MJGwaBhOAGGgpjZDdydLl iNJBnsWb2Oq38knllhxb8/SRBZ2NGVeAuzDf8b/XIOg4uAQodN+W68YdkaKCDqecv7f0 SyrkQVb2adc0pmkHBWcgvv5ZNIIPF1r9wrusdfHTCZlxyXGZD7431bN8dThuvKrqR11r 2rq8oskYSJ7BIuDKEI31+SuuG71TZF45bIYOpGCiPnpZa0K8Ytkllkbx7eGdrrQEvnZq 8x0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LzXDDest3CUEkzdTfsHdQuauscvBvDO73wDHrx59xFY=; b=LMcLdGojoKNx7FxQ4cogXEsoh0ohoZuIH13B46QHGW5kZfG0pJ6K6naY2NsotmLhs5 1SbphKWj0RgigVd/ZGfd3rE//M/PwPXqTgs3o8xANgUj/cSbPCAIKDoQwO+bpys2ikwN OhUs1MRGjkFBE5uuLgBIDhC/OmA5MyM7+9JKlh8/rhxTEx1cqsBEih6w0hqz2QKdwzLg wOUW25QjkLHt/TPekB8f3VjYRYMfoyz05ZRyUo1HUKCZ49Szkt5PGGRQ/kajsnfphbm9 Bz7D2RjWrp2DM/2R6ThJwEXGcw5TS0sOsuTQSsaFYNJ8FQNFetJDZYkRv0pDESXUnYOC muog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WIaMG9Lt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j21-20020a1709064b5500b007add5af39f6si7424146ejv.929.2022.11.22.05.25.42; Tue, 22 Nov 2022 05:26:05 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WIaMG9Lt; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233365AbiKVNPy (ORCPT + 90 others); Tue, 22 Nov 2022 08:15:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233521AbiKVNPq (ORCPT ); Tue, 22 Nov 2022 08:15:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 180FF63154; Tue, 22 Nov 2022 05:15:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 76BE2616F9; Tue, 22 Nov 2022 13:15:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 830FFC433D6; Tue, 22 Nov 2022 13:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669122944; bh=WM+iRdqzMuNOpZH02f5VGpRug8d7nHfgsrCMsJ+cyFM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WIaMG9Lt6nlTmX0jyKVZ2U/SHOqYXjWoz0/K3oxDGjGtw2TeWRhx+SNOhc46LZgQ9 d8ToJoMwc0BedGXgKBnM7ZL5TDhHjdy5+uoWo4+odB1dyosZuRlPPtcXvAohub2FGo oFv5ulf1wF0BIE0oSLklruwZgcrl6wlIReQkHLq8fWOy9vFkGLMv4B6YCgMjLpC5uc 6ooWzgLtitdqu1qPlyEAI8o4a8W4AXe4V84YCaU3KfkpoEiNhO44ST2CqizYHcmhzl wnZoCiufjAjuPEUKHL4QDXpMFMLEGUVw1KkVQJZgdC0gTzzN3mgb7sf5+/BOGMtazA 2uONIoryR+xrw== Date: Tue, 22 Nov 2022 18:45:36 +0530 From: Manivannan Sadhasivam To: Xiu Jianfeng Cc: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, rafael@kernel.org, viresh.kumar@linaro.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] cpufreq: qcom-hw: Fix memory leak in qcom_cpufreq_hw_driver_probe() Message-ID: <20221122131536.GA157542@thinkpad> References: <20221122124627.174403-1-xiujianfeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221122124627.174403-1-xiujianfeng@huawei.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 On Tue, Nov 22, 2022 at 08:46:27PM +0800, Xiu Jianfeng wrote: > 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 Reviewed-by: Manivannan Sadhasivam Thanks, Mani > --- > 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 > -- மணிவண்ணன் சதாசிவம்