Received: by 10.213.65.68 with SMTP id h4csp691841imn; Wed, 4 Apr 2018 05:47:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4984v+7WEnfgGZChuy7cbrXRHCzJN2tyPGbT98Vi0Ey6RyWakp/oSTYZK3VigIL9IZY3YBP X-Received: by 2002:a17:902:7894:: with SMTP id q20-v6mr18802493pll.86.1522846031217; Wed, 04 Apr 2018 05:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522846031; cv=none; d=google.com; s=arc-20160816; b=r25bvg/lRbPcY04uytGn+jIh0xmtohF4HSLWenW+vBWbfaDEOLXSIG3HJlO07FLO/2 AzDSuzBq11JIvEtcXKKmiarFWUk+0Uk64gUl19auDE6eezPRxk3FyWLOhnMNvshgsRng ullV4vUDugTuwNF22WquxRnx1kWaZIC/S1CizuNmPvLGi5Kp76B3Fzmbs6PkSSeQ+mT+ pt+Izaerny3foRHSNZRcq9Xxdy93pzP4VmBK2jBY5t4mkA9g9io6qyiVH9FTiAg2h20B Lqa/6YmYv/Wm4niaQLTLES/WaZGI8VqMqrNbER5hVyfoHB4kV+xh3nvZAJmmMKiPOgr7 6ojA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=Upy8TiS/4NY28eJ30N11cw9/WIX9mHOYV3NkYTJiv88=; b=vpzZmJZwye8Jdp7VK/imsGawkea+Zr+OuDy3S3+t5yGjgv+t/G6lTAtwWHGUtobh77 /lpZDdsQRJlTTgsohUDoaoHrsf6Se7m1NFKQwZzDtAm21qV8MtOiMnXMe9Spju/0A7K0 i2XylyFdle24RNkWxdbT/U2pm+Y6c1d91bAyVK9UzqMdrhauxBGyNpLRmfUx2dTC2wZS dKKNGeunhkrHRwlyQymubBYHhRxATbA3Oa277LUVIncEBn3lEiCylmtzrML450xIyk2Q f8V8rV2cKQdcv+DPqxp4bDB/teSRTA3NK7yEF+cxN+6zpIXFYUlH2103+cU7tHUv507v 9TbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e127si4001494pfc.315.2018.04.04.05.46.57; Wed, 04 Apr 2018 05:47:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751513AbeDDMpN (ORCPT + 99 others); Wed, 4 Apr 2018 08:45:13 -0400 Received: from www381.your-server.de ([78.46.137.84]:36798 "EHLO www381.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbeDDMpK (ORCPT ); Wed, 4 Apr 2018 08:45:10 -0400 Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by www381.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1f3hmi-0003NQ-MR; Wed, 04 Apr 2018 14:45:04 +0200 Received: from [2003:86:2c44:e800:8200:bff:fe9b:6612] by sslproxy01.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.84_2) (envelope-from ) id 1f3hmh-0001GJ-KA; Wed, 04 Apr 2018 14:45:03 +0200 Subject: Re: [PATCH 1/1] dmaengine:jz4740:fix memory leak To: Xidong Wang , Vinod Koul , Dan Williams Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org References: <1522812118-25763-1-git-send-email-wangxidong_97@163.com> From: Lars-Peter Clausen Message-ID: <04a5860c-f4d4-48fe-f1c0-d84ebad79df7@metafoo.de> Date: Wed, 4 Apr 2018 14:45:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1522812118-25763-1-git-send-email-wangxidong_97@163.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: lars@metafoo.de X-Virus-Scanned: Clear (ClamAV 0.99.3/24449/Wed Apr 4 14:20:38 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/04/2018 05:21 AM, Xidong Wang wrote: > In function jz4740_dma_probe(), the memory allocated by > clk_get() is not released on the error path that ret, which holds > the return value of dma_async_device_register(), is not NULL. > This will result in a memory leak bug. > > Signed-off-by: Xidong Wang Maybe use devm_clk_get() since the same clk_put() call is missing in the remove callback. > --- > drivers/dma/dma-jz4740.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c > index afd5e10..082c158 100644 > --- a/drivers/dma/dma-jz4740.c > +++ b/drivers/dma/dma-jz4740.c > @@ -570,6 +570,7 @@ static int jz4740_dma_probe(struct platform_device *pdev) > dma_async_device_unregister(dd); > err_clk: > clk_disable_unprepare(dmadev->clk); > + clk_put(dmadev->clk); > return ret; > } > >