Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8377818rwb; Wed, 23 Nov 2022 21:15:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf4BQaosdgSTOepzCOtDW7sM5Y/mifO1wr8XxLRzvt5qKUVP1310vELZV5x0UoVkcvYV6XZm X-Received: by 2002:a17:907:2904:b0:78d:b598:bb6a with SMTP id eq4-20020a170907290400b0078db598bb6amr13312833ejc.258.1669266910526; Wed, 23 Nov 2022 21:15:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669266910; cv=none; d=google.com; s=arc-20160816; b=nZUzr9CS84nZJanDAdkk/kk1zfcOSNsGGR5LG2eqnSAoOskN+xS8BDC2NxlTsVAguf QvRLWf3FC5zDb9/VgKjiEkElRV1NzzK55+nygpKXj+aZ7ugG+krdWJriELJsJ3LzpuLp 3u2p5gRfZUCQ1ew1uBxU0QkiMl88W66hKsI/+oglSvJfGXql6wKm55G+Bk8IXVhQHU9j GNOCFwUrAwIGbQ0jJjCgV1V1sgrNjs+CzJDMwvco72aqvlqDwOxpzg1Ln0VphSl6aUh0 miBjCTH/tOKTGvODkrxBWoA+gHzuMjoh0a2vPTbHSAMP13Em5BdKhX/fxSB05SITu1MZ 9hFg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Y3IlpfuO1l8t2ZxD1N0L8hvLviKdMAgzjTuRuOu9EfI=; b=04ZOSGv8n92T6Ab/aM4bIhR7LbiAwnq09OXRT5XnQUiYJY1lDn4WDzdP/p4Tu3OvfB omDaWSBQO8KRoVJsR7iNzts8AY/+51pxRXi6TIh/Yh4X//HT94Nft3EyYRjdpZ4ROnZq MgXAHQJkKqb49+3w9j6oxgeb80WsZmylC82UA7TUiFnk1zCk/NyTXTDNRY68IJyVNSGa 9kvhc336h9+cb4K/wtQtJmNEFuNEO8PYZUK1c+Ul3ekEvsHNRcNLHf2D80E7t1o8xK3F 41GxII7q8IpZ6n49CjtWzappLBUG+fHp/bY5nGAZYACzZ7zpNJJf8FpDgOXKu+daXTOl 7jiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jt4VHjit; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd35-20020a17090796a300b00773b8e3b6a1si42938ejc.805.2022.11.23.21.14.49; Wed, 23 Nov 2022 21:15:10 -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=@linaro.org header.s=google header.b=jt4VHjit; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbiKXEq5 (ORCPT + 89 others); Wed, 23 Nov 2022 23:46:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiKXEqx (ORCPT ); Wed, 23 Nov 2022 23:46:53 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B96B6C72FB for ; Wed, 23 Nov 2022 20:46:51 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id t17so458320pjo.3 for ; Wed, 23 Nov 2022 20:46:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Y3IlpfuO1l8t2ZxD1N0L8hvLviKdMAgzjTuRuOu9EfI=; b=jt4VHjitQ3Wup4CeA81dpRf+helm/+HSEGDQte2yD19KtMJQuglDaHUiLE7TajwUYm VnyAF7wZ60U3xHNBZCa+YMYFnVfdjvIXa0HYdmYFj0fELrJRVas4a04gEoYjxaqyJaRc tODpOS6kpov1qofx0XvuxMpRlhSPZHTkj957B+9gq5qtlVfm4sDLt3Jo/P20XzQgkaom yR4wtt4R0sC5gEb09zaCIOAiLJdqp3j80AdH/ee5Hai9hdEvW2QJ48EbZvBMG+9M8M77 Y9yLpNURX/T+SglO8WgeAnPDEC32NxtpmaaSyIOcQAi/189sf2oHPPBNvutwlKwkyWf5 VHsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Y3IlpfuO1l8t2ZxD1N0L8hvLviKdMAgzjTuRuOu9EfI=; b=aaDvqiB5zutOFKyhxPdo7OkOmMSojVIDa6g4OFs5tu7H6VctVYCaQyCJfq6nMw9yOB SpB+NiCEiSFmfRj1jvBGFxAcT5yUtap+8y/St29fDxJkxcrD3gpwT61poeL/QBFfcv5N JXham3ovfB47jAtmfagXRxoQsBSvAHZ3Uybj5wF+2Vw7kfjytJWwOOh/IRZpRWmlgOMl tyC3zQ0+DkTFIFK39iiPRF5sOzr0fyQ5g69biTHgz2xHt6ZveaFgxtptNaFuwLicL5tf ER8xCxaS26/BKD332nR85A2kdlLg83VR1O4i//KlWYiav9o91cr3sIzPNzY80KM9oR46 edbg== X-Gm-Message-State: ANoB5pk6OEOX79iuGc3Wt9GI/LhoYYaAhmP/cXityWQvB3DQ4UTEGTfY 1GiNBYzxgxIzy8xDdpv2Tlu1Rg== X-Received: by 2002:a17:90b:2689:b0:218:a059:1c71 with SMTP id pl9-20020a17090b268900b00218a0591c71mr22749395pjb.7.1669265211316; Wed, 23 Nov 2022 20:46:51 -0800 (PST) Received: from localhost ([122.172.85.60]) by smtp.gmail.com with ESMTPSA id w27-20020aa7955b000000b00574759d2143sm115627pfq.51.2022.11.23.20.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 20:46:50 -0800 (PST) Date: Thu, 24 Nov 2022 10:16:43 +0530 From: Viresh Kumar To: Xiu Jianfeng Cc: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, rafael@kernel.org, mani@kernel.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: <20221124044643.x2j7zxugdt6znstk@vireshk-i7> References: <20221122124627.174403-1-xiujianfeng@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221122124627.174403-1-xiujianfeng@huawei.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 22-11-22, 20:46, 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 > --- > 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; > } Squashed with the original commit and added your SoB. Thanks. -- viresh