Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp644213pxb; Wed, 3 Feb 2021 14:03:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkczH+Y30WH0GJ6hvTny3BAuaGVe16Lzh0b0xDANTdJLHlefQe8PSABLJO5PmvNL3T/n/J X-Received: by 2002:a17:906:b001:: with SMTP id v1mr5208542ejy.217.1612389826115; Wed, 03 Feb 2021 14:03:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612389826; cv=none; d=google.com; s=arc-20160816; b=V3eIelBOofx46VWsqil1oB4coRWbWNfExVTuY3ovtLq3PQGxChe1dBY2pf7fdaSg4P 0YHYr6LSk/prZbTYltoLXE3nXrWnmqT6yAdsxINHz0lecWOXXNKCEsOKReVsSs6kF/fk viDCeowM06whaChtu6NmtkgCX+crr2Rtlm8EHsVp0LUSqEGp5megkiZLpagNxPHRjW2h 7U0UgpHUSGTUUJwOJSb7baZ7coTfuD/B5TAewnj3AniGMPIrK8sxrDYf5WEq3FU4Od39 //e02FCdVb7ORyqNNTecSJ1DaylAMU7fjLwgE1K4GnkaQZHWE1d6HwsoV1HvXTpcTTTZ cFag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=LeJkYXCorWtiaP+yCGj+HszRDmiDY/6LzTvN7R0PDJU=; b=h9Ci1nldMc2cyVKmtsBPe+eY/s+mYgXjEkQ970EQe44s2Z6aTwIMMPIzlJzFgNzODc Z5WaFC8aBkZbHdmC3pEsOLN7EUIFSk7ieruTLHh+7UMk2RA2e7dgKhGvJILBrBW1F5if JJ0SygnOgCxDSASLdlJS73O4frLuG/bT7YBO+LxR/auF8zyTOVwE7qPOa3gn/XLOi9F9 YAZMlecq+ITgG6akp35+oTq8Iwid0ZbCLInMQyHc756mcO5T+EfToRjO9Akl3Aw7Hzu5 tu3KIMjUuZ5c9vR29O3NuVph9mbltWWQ9H0Wmr1hOJomZX59D728uQ2wd5n1aejrWNQg 2nxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=RgfJV1LB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si1879193eja.434.2021.02.03.14.03.20; Wed, 03 Feb 2021 14:03:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=RgfJV1LB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232822AbhBCWBT (ORCPT + 99 others); Wed, 3 Feb 2021 17:01:19 -0500 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:52244 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232313AbhBCV70 (ORCPT ); Wed, 3 Feb 2021 16:59:26 -0500 Received: from mailhost.synopsys.com (mdc-mailhost1.synopsys.com [10.225.0.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id E769FC011B; Wed, 3 Feb 2021 21:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1612389506; bh=71t8kLn/h4uRT+rZrsVOIM9WjcoyjC97XsyNd4xo0/8=; h=From:To:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=RgfJV1LBCuVzrk7nQeg5tDASzoie2bzlzyQv4mQhuaIsPuFBooMy1T2A8eX/4hly3 r25bPn02ezYWW96rZiXQPpaVF5uc77i2vKRpBk8cHnksostFwm6dJxHdi8TB65Mvd/ LmKMQT1r/3TSV7L/Fv77g5h/DephWcfwm4/a7cS41RmNv9CY8EOBGtQYVdsyoDE3Nc U5+Qwg1HGfahlameacyYLeuqa6R4SlwAKr0+IPbKUs8NMDOv1KZb03fdLgxbptWnVT 3bYtEq7IoYRWau1Gnbish55wTo3onD8fqFL4zMXbf7FQbeRoMDD7tVsHqpCaU1XKdB 3tcn6Y46P9KqQ== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id B94FBA024B; Wed, 3 Feb 2021 21:58:24 +0000 (UTC) X-SNPS-Relay: synopsys.com From: Gustavo Pimentel To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, Vinod Koul , Dan Williams , Bjorn Helgaas , Gustavo Pimentel Subject: [PATCH v4 12/15] dmaengine: dw-edma: Fix crash on loading/unloading driver Date: Wed, 3 Feb 2021 22:58:03 +0100 Message-Id: <50d35480bcb5a7ea33649bbbcf296e148f5977b5.1612389406.git.gustavo.pimentel@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the driver is compiled as a module and loaded if we try to unload it, the Kernel shows a crash log. This Kernel crash is due to the dma_async_device_unregister() call done after deleting the channels, this patch fixes this issue. Signed-off-by: Gustavo Pimentel --- drivers/dma/dw-edma/dw-edma-core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 8d8292e..f7a1930 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -986,22 +986,21 @@ int dw_edma_remove(struct dw_edma_chip *chip) /* Power management */ pm_runtime_disable(dev); + /* Deregister eDMA device */ + dma_async_device_unregister(&dw->wr_edma); list_for_each_entry_safe(chan, _chan, &dw->wr_edma.channels, vc.chan.device_node) { - list_del(&chan->vc.chan.device_node); tasklet_kill(&chan->vc.task); + list_del(&chan->vc.chan.device_node); } + dma_async_device_unregister(&dw->rd_edma); list_for_each_entry_safe(chan, _chan, &dw->rd_edma.channels, vc.chan.device_node) { - list_del(&chan->vc.chan.device_node); tasklet_kill(&chan->vc.task); + list_del(&chan->vc.chan.device_node); } - /* Deregister eDMA device */ - dma_async_device_unregister(&dw->wr_edma); - dma_async_device_unregister(&dw->rd_edma); - /* Turn debugfs off */ dw_edma_v0_core_debugfs_off(chip); -- 2.7.4