From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752749AbbJNIxF (ORCPT ); Wed, 14 Oct 2015 04:53:05 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:35522 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752025AbbJNIxA (ORCPT ); Wed, 14 Oct 2015 04:53:00 -0400 Subject: Re: [PATCH v2 2/4] dmaengine: Add STM32 DMA driver To: "M'boumba Cedric Madianga" References: <1444745127-1105-1-git-send-email-cedric.madianga@gmail.com> <1444745127-1105-3-git-send-email-cedric.madianga@gmail.com> <561D1689.90703@linaro.org> Cc: Maxime Coquelin , robh+dt@kernel.org, pawel.moll@arm.com, Mark Rutland , ijc+devicetree@hellion.org.uk, Kumar Gala , linux@arm.linux.org.uk, vinod.koul@intel.com, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org From: Daniel Thompson Message-ID: <561E17EA.6000900@linaro.org> Date: Wed, 14 Oct 2015 09:52:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/10/15 08:54, M'boumba Cedric Madianga wrote: >>> +static int stm32_dma_alloc_chan_resources(struct dma_chan *c) >>> +{ >>> + struct stm32_dma_chan *chan = to_stm32_dma_chan(c); >>> + struct stm32_dma_device *dmadev = stm32_dma_chan_get_dev(chan); >>> + int ret; >>> + >>> + chan->config_init = false; >>> + ret = clk_prepare_enable(dmadev->clk); >>> + if (ret < 0) { >>> + dev_err(chan2dev(chan), "clk_prepare_enable failed: %d\n", >>> ret); >>> + return ret; >>> + } >>> + >>> + ret = stm32_dma_disable_chan(chan); >>> + >>> + return ret; >>> +} >> >> >> The error path here looks like it will leak clock references. > > Sorry I didn't catch it. What does it mean ? If stm32_dma_disable_chan() returns an error then we will not restore the original the clock counts causing them to "leak". Daniel.