From patchwork Tue Oct 25 09:02:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 13018832 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 253A4FA373E for ; Tue, 25 Oct 2022 09:09:49 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=i+C/4R3E2btwCqq5UJdV/H8kuUBvz1wceDV347SgRf8=; b=dBS/5mpK+/oaK8 4c/jovjEv6ElXrHVmKGyRecZCmD31RGH1tX6/5TKDPsEnckbh9qEz2Gv9CoI0TOamABJxnzNBhWvM kg8yBhQx12cRSZUUFUXnGnbUSapx3vzO5BjokWxUBwEdMeDPFkyph8s3Dei6ibPd1QO7RhU233Uvk Kb8q+0qm4HGzDyLgE1XoDYGcoen5x/aa/Col5aDCBZ2bs2Nl2J/i2yjs6S0/Do5R2/WMka/46sBxq Gx83PqVy8LsAqu1fIwa5aghb57A1g9WrRwhxPTdS2M4Qm7sjIHxgqgxA3HLyWMbGqthssLdSh6+ZZ /f755GSHwVJqbzKDXOrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onFvO-004Rnk-36; Tue, 25 Oct 2022 09:08:43 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1onFqc-004PLi-Ie for linux-arm-kernel@lists.infradead.org; Tue, 25 Oct 2022 09:03:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1666688626; x=1698224626; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=otOwHLgHLrSuHRXKEz7Xh2PEvd8g6jBAJ0XHPtc1d2I=; b=S3pf55NZnb5AsBUbdPlHqvj+Eln5ikc68nxjKxx4z2KftjuhF67K34Nx jAeSpMVPj0nyAQC2Nu9ammfroM/7BvbIIUKzDQLvbYrnY8pCA2RVaXB7S wqvATaEQrq0lDlJ/dm2WKTsuvy5v43vYc60dMHOoBAEYZlqVZfgIqomNw lYKK6Xc8fnSx4/f+TFt1dF4zCCeuZx0yAxnnlIeB+gdqEb+6zigqfwRIP R/3VWyU3JJAopyPf4htAZp9xwnpjtGoT2LXsaKi5g5dNmQjCW/RCd2lqj NvqTC5qGKaOjA8tL0q0xTgQ6HrnRKuEO6chb7/DbEMJekij/SO0hnI5Sk Q==; X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="180386392" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Oct 2022 02:03:40 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 25 Oct 2022 02:03:39 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Tue, 25 Oct 2022 02:03:37 -0700 From: Tudor Ambarus To: , , Subject: [PATCH v2 09/32] dmaengine: at_hdmac: Free the memset buf without holding the chan lock Date: Tue, 25 Oct 2022 12:02:43 +0300 Message-ID: <20221025090306.297886-10-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221025090306.297886-1-tudor.ambarus@microchip.com> References: <20221025090306.297886-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221025_020346_714175_D0882ED9 X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. 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: Tudor Ambarus , maciej.sosnowski@intel.com, linux-kernel@vger.kernel.org, mripard@kernel.org, linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, stable@vger.kernel.org, torfl6749@gmail.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There's no need to hold the channel lock when freeing the memset buf, as the operation has already completed. Free the memset buf without holding the channel lock. Fixes: 4d112426c344 ("dmaengine: hdmac: Add memset capabilities") Signed-off-by: Tudor Ambarus Cc: stable@vger.kernel.org --- drivers/dma/at_hdmac.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 2012ecc57826..0fb44f622d35 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -462,13 +462,6 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc) if (!atc_chan_is_cyclic(atchan)) dma_cookie_complete(txd); - /* If the transfer was a memset, free our temporary buffer */ - if (desc->memset_buffer) { - dma_pool_free(atdma->memset_pool, desc->memset_vaddr, - desc->memset_paddr); - desc->memset_buffer = false; - } - /* Remove transfer node from the active list. */ list_del_init(&desc->desc_node); spin_unlock_irqrestore(&atchan->lock, flags); @@ -487,6 +480,13 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc) /* add myself to free_list */ list_add(&desc->desc_node, &atchan->free_list); spin_unlock_irqrestore(&atchan->lock, flags); + + /* If the transfer was a memset, free our temporary buffer */ + if (desc->memset_buffer) { + dma_pool_free(atdma->memset_pool, desc->memset_vaddr, + desc->memset_paddr); + desc->memset_buffer = false; + } } /**