From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50DB8C4332F for ; Wed, 19 Oct 2022 16:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Djyq72mmzdmV5bJWBzZtuFZFaX7ug8a8uO3zChzHn48=; b=Sit2QSW+L+WsKW tBy89RVN64f3OkN9/FgVrrxT0UKvdGVdrNXPlXEftiH8fzqNRvyysXZBZOc+2aGSHB+gOiy7nVtWC OjwGIBqs7EtU4QEtWGoqjcYxHwPCu9iIXP5ScgzzFbHFIwku3mQ+udtUeJBvLM0G6Nlc/VNkAzXOQ O4De1YXl3lLPdWE315GG4Wd0aBca6nNgfP3epFqCAWq20bBRTYI22B3CfV3uf+pRJ9dbS4ANGQTJa tBUhBPLIzgXW1KuiPI/TgocJZmGvSrHP6VxVf6HM/79EMZTVGG6cKXdI4koHKHk7bfiGrRID2Bcib /1zA0Nxk++0K7h3xmtDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olCFi-004RLE-AK; Wed, 19 Oct 2022 16:49:10 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olCFf-004RKP-Hz for linux-arm-kernel@lists.infradead.org; Wed, 19 Oct 2022 16:49:08 +0000 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 2242661959; Wed, 19 Oct 2022 16:49:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7471C433C1; Wed, 19 Oct 2022 16:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666198146; bh=1zhD6GeKgSstHb00mJlu4MbO8vG9BfJlQz73YmXarik=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WkD7RuvnEHkDnggb2aOBdyTek0f5t9C2/0BuWk1RFdCPVSC+dgYRQQAoGiTF1neCz hVwbdbkfjWZ6FvyHdXZAKqqE1bcTDt12S/d9lZpKlgZuN8XPrxKTPk6GVViqCNqJBW fMvcU5uFvJBKBckLMu31qvjD03HIqkMIqfP32iJ8KPEqjceWnh8+MUwk8HEsON3RcU lq1BDj8icWJTDSOgInBNkdORrTEYnMl2FMj93xb/H0rTc12U7zEhUOVzwMkqNZXLtq 52tdLgCGZmfXSCMvKFUUoJ2+Ba6pWOrL0hpmcWW6a+NI4lOQunHcpW22mmTs4efnsB U2Yv5kJBXgARw== Date: Wed, 19 Oct 2022 22:19:02 +0530 From: Vinod Koul To: Tudor Ambarus Subject: Re: [PATCH 28/33] dmaengine: at_hdmac: Use devm_request_irq() Message-ID: References: <20220820125717.588722-1-tudor.ambarus@microchip.com> <20220820125717.588722-29-tudor.ambarus@microchip.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220820125717.588722-29-tudor.ambarus@microchip.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221019_094907_693503_4FD172BD X-CRM114-Status: GOOD ( 20.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, maciej.sosnowski@intel.com, mripard@kernel.org, torfl6749@gmail.com, du@axentia.se, ludovic.desroches@microchip.com, regressions@leemhuis.info, dmaengine@vger.kernel.org, dan.j.williams@intel.com, peda@axentia.se, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 20-08-22, 15:57, Tudor Ambarus wrote: > IRQs requested with this function will be automatically freed on driver > detach. Use devm_request_irq() and make the code cleaner. That is not really good idea! > > Signed-off-by: Tudor Ambarus > --- > drivers/dma/at_hdmac.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c > index 9c414f167b62..96b885f83374 100644 > --- a/drivers/dma/at_hdmac.c > +++ b/drivers/dma/at_hdmac.c > @@ -2241,6 +2241,10 @@ static int __init at_dma_probe(struct platform_device *pdev) > irq = platform_get_irq(pdev, 0); > if (irq < 0) > return irq; > + err = devm_request_irq(&pdev->dev, irq, at_dma_interrupt, 0, > + dev_name(&pdev->dev), atdma); > + if (err) > + return err; > > /* discover transaction capabilities */ > atdma->dma_device.cap_mask = plat_dat->cap_mask; > @@ -2257,10 +2261,6 @@ static int __init at_dma_probe(struct platform_device *pdev) > /* force dma off, just in case */ > at_dma_off(atdma); > > - err = request_irq(irq, at_dma_interrupt, 0, "at_hdmac", atdma); > - if (err) > - goto err_irq; here you are ready to receive the irq, but now you moved it early on.. it may cause issues.. > - > platform_set_drvdata(pdev, atdma); > > /* create a pool of consistent memory blocks for hardware descriptors */ > @@ -2377,8 +2377,6 @@ static int __init at_dma_probe(struct platform_device *pdev) > err_memset_pool_create: > dma_pool_destroy(atdma->dma_desc_pool); > err_desc_pool_create: > - free_irq(platform_get_irq(pdev, 0), atdma); > -err_irq: > clk_disable_unprepare(atdma->clk); > err_clk_prepare: > clk_put(atdma->clk); > @@ -2397,7 +2395,6 @@ static int at_dma_remove(struct platform_device *pdev) > > dma_pool_destroy(atdma->memset_pool); > dma_pool_destroy(atdma->dma_desc_pool); > - free_irq(platform_get_irq(pdev, 0), atdma); Now we have an active irq while we are unrolling device, which can be fired and cause tasklet to also get scheduled... You need to make sure now irq cant fire here and tasklet is killed.. > > list_for_each_entry_safe(chan, _chan, &atdma->dma_device.channels, > device_node) { > -- > 2.25.1 -- ~Vinod _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel