From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756202AbbGTI2T (ORCPT ); Mon, 20 Jul 2015 04:28:19 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:51990 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755407AbbGTI2S (ORCPT ); Mon, 20 Jul 2015 04:28:18 -0400 X-IronPort-AV: E=Sophos;i="5.15,507,1432591200"; d="scan'208";a="140601094" Date: Mon, 20 Jul 2015 10:28:14 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Alex Smith cc: Julia Lawall , Zubair.Kakakhel@imgtec.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: question about drivers/dma/dma-jz4780.c In-Reply-To: <55ACAEC5.7090000@imgtec.com> Message-ID: References: <55ACAEC5.7090000@imgtec.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 20 Jul 2015, Alex Smith wrote: > On 19/07/2015 10:08, Julia Lawall wrote: > > The file drivers/dma/dma-jz4780.c has a probe function that sets up irqs > > using devm_request_irq. The probe function then ends with: > > > > err_unregister_dev: > > dma_async_device_unregister(dd); > > > > err_disable_clk: > > clk_disable_unprepare(jzdma->clk); > > return ret; > > } > > > > The remove function, on the other hand contains: > > > > of_dma_controller_free(pdev->dev.of_node); > > devm_free_irq(&pdev->dev, jzdma->irq, jzdma); > > dma_async_device_unregister(&jzdma->dma_device); > > > > The need for calling devm_free_irq explicitly would be that it needs to > > occur before dma_async_device_unregister, to eg avoid a reference to a > > dangling pointer. But devm_free_irq is implicitly called after the call > > to dma_async_device_unregister at the end of the probe function. Which > > one is correct? > > > > julia > > Hi, > > I think the explicit devm_free_irq() here is unnecessary, as when remove is > called there should be no remaining users of the DMA controller and therefore > no chance of an IRQ occurring between the controller being unregistered and an > implicit IRQ release afterwards. > > I recently sent a series of fixes for this driver, I will send a new version > with a patch to remove the unnecessary free. Great. Thanks. julia