From patchwork Mon Nov 11 07:26:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13870319 Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010048.outbound.protection.outlook.com [52.101.69.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 546BE136A; Mon, 11 Nov 2024 07:26:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731309986; cv=fail; b=GD6bEeYjcuh/Oog8zwiCoTe41cLaEyVC4QnthkCVgwDx7dvbFLhMZ4HwDq1P8F2HX7tlt9fs8XjsvUg3q4iFc3RSawD8a0HcGvnXEbbD2r8vckMCgKYPh59j/kw8LgRaxoC1hiiPEUeqGVsw0FXg862E+31bPDXvjxxD16TYt2A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731309986; c=relaxed/simple; bh=y0yDb7wi13Yq8Bz2eAqntIkNUOOvEsIIFhn1Eqgqcos=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=MhySO6KL86s59echW+sUilx204Y3E+ZviWTn76lWYVWgBjTGULyIeUbKSVbJ+tD8a9hb2AbJLTLyJp/zjuOy3q6UKZ3asW8uINRVFiG15nvcrZuiYPykUYZj5bvHF8s8voMSgJcoR9Vz0HrNQD5mOvls8DkKCvPaWVTMyXhagQI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=AndeUi9G; arc=fail smtp.client-ip=52.101.69.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="AndeUi9G" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IMgJ+HePActns8hynGUm3j9WLSCDyyrCyZc/mP/jztyNjerH05tDaL7SxlXhy0vE9I1JLGrfvfhTW+Izs/NYSSX+S7BPbtQwM5MTXJb9GhyJ0/CN0IkV46SMnazW+s+JpNvaESpnXm9ZcDxeBdsL+dFJvQp5UpbHCtigJyBu5L8a1Q6sw5lDiW+jT8a5p588Fdyj8XHcoUZO4gDR0w3WR8AA67Vcx4SvEr82DKhHBaiBU5DhhdIV54/3/I23ducUFrDBOUqSs+EtPtyZhO/OAzQU7yOS+8kySgij1eu0sx+MOYD6e1PWVF7CusaE/p71r75+L2nEJvdkkUN7iWfKyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P1TMmag6hotFLU3OzdQLyDbwl0oGZUpqeE0Z2YcpNk8=; b=Ka3eqZshUgm5XeNarCeZV/pLHWZBIyhhllIJd/tkvGpyB2ak2Gfycbor6XpNRjm7ubOv4YDiL1wOshgk6+QZ3dH+D9tb6fB4nDXuOycC3efnLw9Uq13FaydP76RH6uH2jssr5xN4ra+18/0+rxeDlBAfnQNYXzzd/xTu5WVLCU1Ub2O8BAftEktLjJhmHF2HqNxYn2N/UsIHFNhP4ZuAbJKVLxJyV8RXPx5pxKmbNw1HWHKAeIsyGAtZToq5VtSr41AoMRkmngVJdwSxuqviVdyJXjL+/DcPmCrBsCysKAtGGxqu70SlEgL4NaqGZGH+g2NOaLOy7W2KlEXKjr1Wog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P1TMmag6hotFLU3OzdQLyDbwl0oGZUpqeE0Z2YcpNk8=; b=AndeUi9G021EdjBsgl+hYpMYJQq8Z4wwx9MjwkrvaPuQlc9Ebb4tU8L0SEhxZ3grOGYLUi+Jvi35QDPeLsR/r6mDOnj6OTfcOXJyRj3gvSeOU1TQlaxU3t4xEHKWzfn/DG+B4L1qjPoyP4RzRg3nA1awpLLD750HcFg8+R5dx8BqogfvKSsZ0Jx+MKtta9LzeaH/3kX5/8Axyk7QxUXv78acSCQS23iOjFEYLNS5GWe3K9fk0lfE/Zcxhcrsq/2rA6djIkrPCaoCyhyRuR0HMHCp+NQDx7v04Tf3AZb5ZOEDmt75OmZTmO3BpLc+aWgU9GepWhwWL14ofJPEGU8OpQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by VI0PR04MB10854.eurprd04.prod.outlook.com (2603:10a6:800:25f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Mon, 11 Nov 2024 07:26:21 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%6]) with mapi id 15.20.8137.027; Mon, 11 Nov 2024 07:26:21 +0000 From: "Peng Fan (OSS)" To: Frank Li , Vinod Koul , imx@lists.linux.dev (open list:FREESCALE eDMA DRIVER), dmaengine@vger.kernel.org (open list:FREESCALE eDMA DRIVER), linux-kernel@vger.kernel.org (open list) Cc: Peng Fan Subject: [PATCH V2 1/2] dmaengine: fsl-edma: cleanup chan after dma_async_device_unregister Date: Mon, 11 Nov 2024 15:26:00 +0800 Message-Id: <20241111072602.1179457-1-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 X-ClientProxiedBy: SG2PR01CA0134.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::14) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|VI0PR04MB10854:EE_ X-MS-Office365-Filtering-Correlation-Id: d3ad120f-74fb-4454-5978-08dd022223c8 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 0mo014/FbqAkXKOmjlTdGuB6i2k5E6yVoSUZ3SMNjV5BO4WPEncl38X4nFoKs2Oa6o2v+3yuK+CGmo/wQ01hAAckLtJJ2cUaVOav6OeiVNV7MJCcWn2z6HktSfX0uMaECEbD8L2qJmwSsL8ffdCeHuk0SO9c3VdqEcKKChuEszgGDrZY53VesIHidMLnnDZgW9DsPU7Jl/R21SePY2PZdvQz2sFBsSGjdu3S/eR8Wt1YtUb5Txtqxj41lYAa05Rmlt2/xetU+FWh5IZyCbGeiikro9JxLgV5zyGhNqD0m+7+yeqs015Y5v7jafP4LIoTtBunHEwghT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:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(52116014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zIzi8KsY3KMi1codqZeEz7/TVv6aXf4sO3dK+mYsmVNhZe2Snv8Yco3nRIqEqmyWOgPXgIomKDQhs8AlOKv2OVsW0OSoIFMoqeyGYPBaKv6dGMCdX7sKiBtwKwQJVOMIpfcnv2a+Ny3Mij7OLrd1dWolDSlaK/jCunL9h9wZSEvu1293qRxfrm+zFwoVMpUD+TOjezDQ89B9wseebaKjEOvFjiyFH/ctqUdGyphUmjWWBnWEQ2IMNIN0UwGA6MqNuV8HiaWLng/UPsDUDyC+UpGhQkOKtYaUl3T05bILo/lHbP0vLsuOamO5W0eufw8ZxfGtDmtXMvpMCVuo8mA1N7Y2KrUVFdrFgV9rXrWHqwIk17c5fN0hDshTPdHrgktm8oQj6FrxrIcMpS6VHJXUTZv3Jgo6lpDm+5gokTFi4iJr2MtUJUh8lTnwOsGWgcwW4p261tSAIfHq95TjCKdHis8jdb5EFlMns2m3SQdKr2dgEtqgl2ykcyIRopHk2WwvgEsSi1d8qlcPT8yRVA2cF3swAYAPZexkXXf5rv1WJhiPqtC07nXNPP2CDRlRFvowM8tzeJ8suXvYf6dXVFs5vLMxaAHlqVgmjkzc1JRdu5I0xBz2N9HF9DliQMQIqdP8VbJngI4zhMmTL2aApqsKwEQ6+jXdANErA9A1Jgq9wX5um9KVY8EjfeFLKvAHC8i82z599+R3lHGxT/iN2HXOLYqeA6u5xxM5s94nVUQikmFinwTi55Gcv/ci5S7WUo7AEXvBtdDAD46xPwS9CW0rxl1+U+BesqCZxcnNnodf7GrbMCY8NNR+kwnmuY5ljm8TbJXHy8saw9h7wjvRECtlbcmo3sFFhc1kHBuC/LTLNG3C4rUeS7yYXXEdsvRHXy1NyU+yLU5lmWfvW5JUzfhmsB0mHm3AteBRgg8vl1qxiZ/IdYe1RvcP2eWM36DM/6yB5SDlw8IxZPDmpMwlN4fzYMvq11qS6pR1CudSCqp7qklrHRtkJTUnuX9A72wrAorGZlrCCmCOp6Fi6pMOFelsXVn1Go254+NrlKaOKChTbF0US8sWtZCUTJusXWHkPkZWTIpwX37VBn4A97BZUSdG0VsecvbnodHWVZbadNVWLmHg1XY4VLzwl9vqkqVNPw1tmXfvEI3+VsMVGYpi5p4UgkRnObJWQ/cJAP8AGfBZJHX3EBqhLXPAWNI1111VORTNnfijS/lw788Cz4sr9qZhIA1TlPKYNZeisNZknMl5m+RhA8i751YuuWNkhGwOs6JdDZSROH44xV/Mxb9PutqTBWXOm954rRbRt6k6heMhcHWSo+uTrAQmU73v3XAhcQaH1JfFfcw70tNoTilS0llZcHoy2zclWxB+kNew4wtUHKJzrEWdEcAb2B5AyI/Ld1QUhptiSXY+rbO3uMyP4H7n4HMZYJ4ZGzKwhPvgVBtaksT0kKII2pYC07Fbva9rcAGC5LP0ohaGbkbmqn5hfMZ4GsVMBPRDyaXg/o31Zf9QBREDLiTo+oO5sE+lJpc3BDtEZ9RrHsrVuzj2uq84Wl/yBkLrXlNu9Zzz0EjHu5zT2Q8Ugk3xZfXxFrO4ZLL7bQBS X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3ad120f-74fb-4454-5978-08dd022223c8 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 07:26:21.2236 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1W/3pm89Bk89MCyEj8k2XuTiBS36ftmvdG8XklgxxVkA7Tuoh8h7vzestpMTWVTIyBMHVoLEWeVXTw5eEAHOkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10854 From: Peng Fan There is kernel dump when do module test: sysfs: cannot create duplicate filename /devices/platform/soc@0/44000000.bus/44000000.dma-controller/dma/dma0chan0 __dma_async_device_channel_register+0x128/0x19c dma_async_device_register+0x150/0x454 fsl_edma_probe+0x6cc/0x8a0 platform_probe+0x68/0xc8 fsl_edma_cleanup_vchan will unlink vchan.chan.device_node, while dma_async_device_unregister needs the link to do __dma_async_device_channel_unregister. So need move fsl_edma_cleanup_vchan after dma_async_device_unregister to make sure channel could be freed. So clean up chan after dma_async_device_unregister to address this. Fixes: 6f93b93b2a1b ("dmaengine: fsl-edma: kill the tasklets upon exit") Signed-off-by: Peng Fan Reviewed-by: Frank Li --- V2: Update commit log drivers/dma/fsl-edma-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index f9f1eda79254..01bd5cb24a49 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -668,9 +668,9 @@ static void fsl_edma_remove(struct platform_device *pdev) struct fsl_edma_engine *fsl_edma = platform_get_drvdata(pdev); fsl_edma_irq_exit(pdev, fsl_edma); - fsl_edma_cleanup_vchan(&fsl_edma->dma_dev); of_dma_controller_free(np); dma_async_device_unregister(&fsl_edma->dma_dev); + fsl_edma_cleanup_vchan(&fsl_edma->dma_dev); fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs); } From patchwork Mon Nov 11 07:26:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13870320 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2087.outbound.protection.outlook.com [40.107.22.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 211B9159565; Mon, 11 Nov 2024 07:26:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731309990; cv=fail; b=bIiueweOwQwEwwoccBgSxG/gqKhCmEgpX2zwjrDDwRj4t0pl/S092stxQG8vKToanatBWeO/EQKr6Jk7tDAc/9wvtXQWafBddRjAFAZoNT9lj3TXyqb8xc6peJIbnqh+PyhR33HMkBvpAHpNFQp7qrECsD98j39qCfvvLAiOBmA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731309990; c=relaxed/simple; bh=FOyOG3TgFJuJKd/0OUNogp+OkjAaVab6ZqYcwd43b+M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=fZQGvjsjpCF3/uNBcL4f2wSedzEDlBnH0JNioCe3LITwliNr38rMhr78ZU+8BaXcHfdjcliSsToCdOpPAMZbsXV9xaTvHdkMOSismvC+67qdyOU2MpPmh+z4ik/tdV0l1oGj1EyWvZBkOBM5SQfimMHTRgYJhH+cM/gkrIJYOMg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=XtimhoX3; arc=fail smtp.client-ip=40.107.22.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="XtimhoX3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=borsMF135Y/3Eah++yzle81vdWffu9Yn23sEvmW1gnfMe0kmPsZNJMttyh9tIEi3iUnX19a1lsJZX7NL78kGGPWEfVbmvZnR909CO9YJsbNY9CEdQ1hZgRzu8Z2IZooQMMbRgKIQf/Q5Z+pmEPSn4i69643f8Uvco7dnbuSJgmfHySPQMDms2cUMjP1GBBPadaC6LGKYUTZ7sxUk3OpsYWCCMPtEvXUWCRF42e0P+DhoLk6p1m+OoHjWnDJiuTLCPWahV/7lgec5EwL+4DHgj7fxDWOOar+9fwssSs34ehUhmTW/ntlYmdZDvRpb28lZ+/Khp9NigE7yAUrOGLK6xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/BsncxoQ5RypthZkFgD6XkknO2HJScoLYoedKX2oyGk=; b=psRc6/nniT6Rn8vQK0cTlE0jwbFGDtEzFo8XsUJktAjkIEJ4A6C4sd5UdCyeeNvKOphkRJ7QoIr7ivE2n0r5Nn+KYD5apzoBrYII7tJr5fLgtAh4yIg8dzTtP86hE9dE7SrGGF1qv9TUEs2w6nmU2HGMw0AfjFZB4gUNKGPmAV8NG0SGpLBcPm5srMpYJd7i8DO93XTGeyZKtRyiVUwl+qtzQ1cJ5/0zg+NqESyrEpXPN2anu43wdbmeMfeYeUFLsfYgrPqVNjBMW1rBXXR5r0CtJHmPsOFvR4ymnM90hPF+K4TPzvnWeBR6rDeVCtKvQ9yS+1Z/TZ9LMCeVxlT1dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/BsncxoQ5RypthZkFgD6XkknO2HJScoLYoedKX2oyGk=; b=XtimhoX3VxQLOTct5KVqLDy52f+ZfNKocwF8xh4b9Chacp+ymxSOepWdvaOqAn4/r4shQMH82H0xphSIvw1uhT5vML9HTFEnOCHCvkbts7ryf+azLbAtlTRe9RN6OD1LUYAlwN0VyWR89xAoXBP4EwhYdpRVi4bOykLUblEiFTtPx3v/Jrp7p2wvZ8qsQ15ruLQU0z42HREflUC3l0Ay6NuX0hoq8YF1wLW15O3hxg2WvIMDlYKbB4Zq/xbqLbtNZrXumPEgQ5LV7tpqH/ILx2hcvYBEDTniBqrY49sTZtxIBjHj8iyF3pvZyv69LhJ/u/TEfVXH4PzsUfswkXCwHA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by PA4PR04MB7920.eurprd04.prod.outlook.com (2603:10a6:102:c4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Mon, 11 Nov 2024 07:26:24 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%6]) with mapi id 15.20.8137.027; Mon, 11 Nov 2024 07:26:24 +0000 From: "Peng Fan (OSS)" To: Frank Li , Vinod Koul , imx@lists.linux.dev (open list:FREESCALE eDMA DRIVER), dmaengine@vger.kernel.org (open list:FREESCALE eDMA DRIVER), linux-kernel@vger.kernel.org (open list) Cc: Peng Fan Subject: [PATCH V2 2/2] dmaengine: fsl-edma: free irq correctly in remove path Date: Mon, 11 Nov 2024 15:26:01 +0800 Message-Id: <20241111072602.1179457-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20241111072602.1179457-1-peng.fan@oss.nxp.com> References: <20241111072602.1179457-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG2PR01CA0134.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::14) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|PA4PR04MB7920:EE_ X-MS-Office365-Filtering-Correlation-Id: 5dda946f-d1fb-4127-24b3-08dd022225cd X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: cOw+bCz8UfqJnVjLu1xM0PssJPTOHvCMCa8tto7prHPnmwbA7deoG2Lyt92cB3+CD/QqpBfoe6I4dZyfv9TkP1WnoeiD7sRmxDolWW/qYGg2avAYChzXyYAi+9jtjyvhryc08tT7Q+Q6Xpg73saa8eOySMKRKscL0xnht/sFXnIXEdSi/98fgHXhQ3X12tTfTVaf9tEDmgpO2j97KB7L3U27DM9TWruk3bRqMqW+LxUQKXVsVsdLI3HQParoXNMPV59EOEynQ+TuVqCgPpMCb0LZHFnJ/QhlulktdVjhuBy5gosdUuYgtL0g8gDFkspMIpV4J0eACJUV7+MRq5SbtslIvDhLMbgeqS55BFMs+ekuCt5mpj1jc+G0UGr+uCfsWAW2VPY1q5RnLFIt0T05DP5AOFQdkNTpUDoAOMCICLvuDUe3QCRZ2FkLL7wI/TVzsqCac58nNsg8G5f0ynLAuUSWb7wz+pyvogFSG40wkp2QlT1DkbEz53nAXfHGDuGVRLHe+1rQMsGM8l+UsgHE1yYd3CPdfHRha/2m8h1v/LNUHRyLNUyigsiFW6G7J5sBBO2w1N44t4z6i0ECz6qaM48ynPhDPgLBmCd8GMPz/Lm5M6aectdJelhATmVe/PunudgvEUgDb1PPI+0bz9iGlbzqhki3sG7hUvxzHDQ/wwx/SLuGdbzINfSq85G99y2A9nAg+7ybAT0I/xJafUtoAayZhbVMgdlTQehEHA59zunGdeY4B88nCeWIAyYosYhQaCPrDGz9ac1YsT9g22Py8rqBAFn8TD/TQqTjN+6y/6GklpPoqah1LMPXGX25Myw8StNilqlv56wJEbBJa9QU4BAuDHQkOCdlUa38eNStBKqQf5wvt14Z/CHzttde/v4yiyFTJmcZLQFFwVj3MyLQQO+ssFfzCDj/G1ajDzebxuj8WZDf84rl04iNHCqir44rTyg+gMRL4m5wMxTP3SofGUK6SRdynzyzuxGkSlsXN4ajK75d+qDPK7GC0kfKnAeBXdf74kYJJzDklkz5zTkOLhxKvlJwIMTMst6PUN0u5NF9FcU36i53DZBVx7pJdjCLFV8TcrpONdQPGAnxwLyL77kqVsy9gI0wt7n7E3TjZiUenelkg6KpqxajLHK60AEi2heNzpu9Fl4d+99nddM6cDXDG6Z7eJPfNU4q+jlX/p7KmurPsVEbViEUxOu84vqPGcYjzlNYj3bIEbab2rmgqB3tRhYEJVKOnwXH2gtpD72Wx277Ge0fD9HYyjOy+1kL+YZIHEmpyndlz1hVWnAKIpxg4dDY6sLb68DpKk0ZA3nH+Vn/fRI3SEg9h9Y10LrYsN85AeTjIADu5SOd458bu8bW0YyOGZrpW0WEa0Gcg8c= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(376014)(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gZIkt6r9R3YjNCBjJmHdWpH/zla2qGS7wVdjQZmtmK4zE534sx0fgF6qWxiqJ8iFFhSPmzhn8oT+2dfipzeFyt45lQraUGPjraExTmDeC3jLKSpxM47CYsmeMdqrh8QArYjaKi084O4AKZSX962p9txoRzy9VOtwuVMrpFgzcKHvopuX6lgHJ48roJ6ZXyNGoPaUUuCY41tzgL/m2xHoIxY0PbPSwBwEChJET+DQHO0F8ejivRPlekVBzUXzE+/OwXSgfv70roWkL+HtwAdRX12CZgEH911rRY2f3XpT3hxI2Knie/m7OZ2unIUQTAabgPms9K2G5IE0UxJCmYn2rWP4xV8e72uz7ZVY31uNlrZiJ3EmaroSCmcrB+wTninstW5OXpvnXO2v+fDFMfVMvNZX/NMOEVszIEwzYNlG5F023UL5loMRvhuPJI6lUgGlrGqEbjcYih342jG6B9NYCP8JqC6WrbvXA6rVJI9Cy4p0ymhJUvvRfb57KmVAeg6hCCZNSzJX+25FFW77DvmPQuwTV9EcHUJ8dlSc1bmQAzD6bTa4nyBgdOQ3RHjBbrqpVOJ9HOW0d3MNhot8ImgXQrcK1N+UFY X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5dda946f-d1fb-4127-24b3-08dd022225cd X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 07:26:24.5012 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bl6LhtYXn5fuJHmLKKrHpjLcdtKW6R30BazFCR9W5e58xBoSg42zBdwJSaTJVpuInmYPjKctgjwqykscjKjPUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7920 From: Peng Fan To i.MX9, there is no valid fsl_edma->txirq/errirq, so add a check in fsl_edma_irq_exit to avoid issues. Fixes: 44eb827264de ("dmaengine: fsl-edma: request per-channel IRQ only when channel is allocated") Signed-off-by: Peng Fan --- V2: None drivers/dma/fsl-edma-main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 01bd5cb24a49..89c54eeb4925 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -303,6 +303,7 @@ fsl_edma2_irq_init(struct platform_device *pdev, /* The last IRQ is for eDMA err */ if (i == count - 1) { + fsl_edma->errirq = irq; ret = devm_request_irq(&pdev->dev, irq, fsl_edma_err_handler, 0, "eDMA2-ERR", fsl_edma); @@ -322,10 +323,13 @@ static void fsl_edma_irq_exit( struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) { if (fsl_edma->txirq == fsl_edma->errirq) { - devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); + if (fsl_edma->txirq >= 0) + devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); } else { - devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); - devm_free_irq(&pdev->dev, fsl_edma->errirq, fsl_edma); + if (fsl_edma->txirq >= 0) + devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); + if (fsl_edma->errirq >= 0) + devm_free_irq(&pdev->dev, fsl_edma->errirq, fsl_edma); } } @@ -485,6 +489,8 @@ static int fsl_edma_probe(struct platform_device *pdev) if (!fsl_edma) return -ENOMEM; + fsl_edma->errirq = -EINVAL; + fsl_edma->txirq = -EINVAL; fsl_edma->drvdata = drvdata; fsl_edma->n_chans = chans; mutex_init(&fsl_edma->fsl_edma_mutex);