From patchwork Fri Nov 15 10:56:28 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: 13876107 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2077.outbound.protection.outlook.com [40.107.21.77]) (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 A133D1B3920 for ; Fri, 15 Nov 2024 10:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731668221; cv=fail; b=iz2LturQ0HQ5ssPyQ+LexEZlAmIM1XRQq2bnqshk0oV3NzOe4uZQraMnyyCRMrQAgI0KxFAbfb0aoof6B6UnpKm+9b98aCic6qM7BTIDospKquAMa2Rxb8QV8x5UzZ2TXR/8xkknhdiLn6Kl1XK0ANVqQ5ZhQuOhEHKJQsBEhwU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731668221; c=relaxed/simple; bh=idej7V0ylHHgdF9SsDu3wLBwFBwH6tLD3x2Wy6eJkac=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=Ky1gf5myTXOTJGWEVmnHPH+2oucJ1/f5cw7CEFg/QJbF7By4FaZ0IAozUmwR1R8wVH3DBCHci7mMXNHuliFSYOtlRAkN0bVCy3njbFiAmgSBIf6yawLleafhnGFdcYVl4XGlh8kJgAwUMeAIj8DsT5RbxDD2NnyD1ThoyASXDi4= 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=MPEUwo3p; arc=fail smtp.client-ip=40.107.21.77 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="MPEUwo3p" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AtzZjv9sPjk0Ud66KYfVRiwDSgECpzSyIWQjuIaVR89g2A4iTj9HxDKj+nC4wyjlkoyo+YpTUVKk4uthGtaFnrYJWhGnkl7oIqw3fk01ZXgEIjv8eEmbfpj2zXgePLMA8U8ejSaE5LasCUOykB8StqIdI/eyYM4aiRbPL3lXEKs+N6OaAOoDV7NzId2wVGVvA96pEYqWUU1vp7Sde0sR6A3TXc0lczUwubTC+aJx6BBl3b3c3rMjS0Qw2nfsM3LGAWjXSyFI9I6F6ebhkcecumCGd6OTBCkdMHamN6h1j8YdyjUDYrvlYm1/Tygy4FrMFGy9N07nBZNnZnhaGvIdNg== 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=N1KV7aI61MGC2nTtRCRB5TVlCBfpV4dZUl6F9lJX2ok=; b=YNFMiTFGurRRkea3mAY7Ztbp5SxCn/WKaIiPqtYdYAA3M9z67uD0vHP14B5wJ/4rwh/Hgiq77ANEa9w7MEjOmL3czCvM/G47zs9SJKlLiMHOEA7CgOCma1zPYd/D8d9jjOAu2OQJIHeTmgUoX+dIj3Nw5prMs8lEhbD8zZQ5rIqplm5JacTA15OZSeag/msGwmEoW6PVZXUguPUyGakumdPRssr7UWA/z0dUtTfWgpkH3yEztcyJvS6VbMnrJh995CaJ/HNT9h9oW/JOCNpj/ZZrqopsDP8/ctZNXWbe58R9SGz+BXGB1NqC6csZ+IhFZr9aDYr+ou18j2+1J8Lh9A== 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=N1KV7aI61MGC2nTtRCRB5TVlCBfpV4dZUl6F9lJX2ok=; b=MPEUwo3p5PV0eq510CLxVpQgclezswbIWZSD9uvtT1/2ffujxApeMjK2OgNw/2Hx9PRymRxUxoL4shtN1cEXi8eXiFvRWo/zhkydya2iIXysL9m1y6TyG/c81f4Lom2ST1NuCNPGNXxSUk7RTMaRI6JwOV7CU/5GXuq3LOC87QgwKfp1lyUR13NevwLm0JB8nZoqu8kHb5dqju7Joo2j+Vs9Llqp2gkw8ejTK8CaTncvWgnzzV6b36YKyZdYCGUkibR5ShnG+aqRnPFg2ezhWBBB0VyJUUIYF4Zv6d5nMDNL/Al1WVfzlq47FcW9cj3SgMCbfsby10srSKbFLX+Yxg== 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 AM9PR04MB8416.eurprd04.prod.outlook.com (2603:10a6:20b:3b7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Fri, 15 Nov 2024 10:56:55 +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.8158.017; Fri, 15 Nov 2024 10:56:55 +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 V3 1/2] dmaengine: fsl-edma: cleanup chan after dma_async_device_unregister Date: Fri, 15 Nov 2024 18:56:28 +0800 Message-Id: <20241115105629.748390-1-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 X-ClientProxiedBy: SI2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::14) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AM9PR04MB8416:EE_ X-MS-Office365-Filtering-Correlation-Id: 47f9031d-d241-435b-f3ed-08dd05643814 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|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: sbd//TdgQa4EfgyLo3zC5ERtfev214c7uB0t9FfoU9LiyiK3pBnVJnS9q8fvTe9ZD5oX4AmrFSXLtefVoR4C7z3sYLhFYyuooyr48ZuVoNAtJqqesdBxHPedvIqrJYPYnnXh+QgOqBlvviVO6uhVUBumazCph8JfVwqBeQhOpSaKzIhXb4Zf8C6asH+gsXOFN8hLAjpXNlpps/Oa5QKDo5b8dqSBEjSKeoCCoC6ZosXLXV15ior1XHLMYQeCjYnbVRKwqe0vQ/0fmgr5nFmGNU9E8isYXAlRtTWxqE+GWo8T5ZQU+nERIIMku4LiiFjn8QGi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-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)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7oHRWrUwS+bNQnrMACQfG8GScQcW+CkNvub8kLZ+z4cgpQw2HXcgnU1ZIFEAGbX4jGQtHU+/TVhSRQa3EHAbUekuYfopEkDzuoDWy3K1VgfwbEZfACETbdm+XLAPZigsU6bHX+/SzlM/ADvNDRlDIpHs/32fFeVwyF5LSd5NP6+ANNkLMELRosMMajF0czRhXHN93XnNC3+VNIwMZPL+tVqO/+QtklwGN++WNkqsIaI5VOpEZK8ilhyubMu59G9k3FgnLHeev0ksrIai77Je6I1ND5oqZXsIsKjgNF7XLcr7tu98h86O7ox8eONT1WDI+KWd1CCcYobjeiH5U7oGS1PVK2ZHAbQURtMXrNE5yQEzM+6ikJl3ZYxy4iEaEjcC6D5hKpLwaKXvDcKNaAN3Wv/PcPXOd6k0GLi9Ds2HvxS9ljqa+44+DV35GlzfltAhfmqg23LixEP38WNHO7Wyw5EjEckICxexAP6QAgEC/EEfakuNCws5YnGdCdsXv2MYbGrYDrKrnWNUbXq7afBY/Y4iS9CuX2vBBmiEawmQ1HzgZLsLeklnTRO8y6f53QBsP/Ggrd6ZJY4bgrZbvQiYvp/U3eB7O+DgI2g1mkSWvhikALHsbZ22ENGUmIkXB9zpYhPLa1/pGZ2S/oR+87pbimCu0kHBfDy1lWUrNIyDfLrKUOBLLGGtRXFr9iTJLCiLzV34Ol3ztFl2nFw3wH8a4CeyCaFVIJq0mMnrXjV3FVDFYKbnM+6hfE1zr14jTF+mIvb32ND9Wla1OBLuIgtnD4Qthe0YBbrWloqQd6tf927VkUMyruM+jieyHnMdvBjzUB9SMMIHylJ4Lih0QGk9Zp8nK8pJKmHVgtZKLBA0AqV7kAl7wkRPbOpqGzcG0o0EWrDmUkSzmvD37ZI82bvckCnDe7JuAQ9tHYdBq9HrKnPKHjz28TniO9OiuCvlfveF+3B9+3TT3h/UYMWRA2cjx/oyChUpXRo/WS869wA580hOvZy9XsEyiivojN+Cjud+ZNdz7mynIcSLXUEt98M1yEI1PWoIcZSm863EQFFTMuWBwMJofG1/Z+XjccQulMI2klAE82YwuKLekVnf/vQefZF9/80DIlLrUj3GvdfOImIlZIfOH+VHw6QEOy0lCW5EIhxLNwKvI+f3zpEN1go2mEsX1QDu7qz1ktR7EnhelcqT0pr/NoTY/3u1hHNcKBQ8COqGDO6AWrxM5eDc+i4zRliHpgCf+c3VwqvIGSAfOX+7XwBaZURpkgR4JXuzvAFoc408WXvtQ58f5MMtD1dHpsQ1nbbdKYdzQuyGkLMgsgZsBjbkPNnMzXQp8a6myf5xisigiKgAcpb85LNc/YDMxUlRjPkX9KhJ/lECWR2yBAxaYRkqNbZwmC6Hgn6ynMlNRhEg/YSVBfF8kp4frqHF8VnYr9+91ZFRoYcX87w/CYiwIz/pA0MvFCb8IA0MGjFaNjOolUapCdncHvicy5jotKWcQT+PGihhDxXxS8vcwA0JwgP0SSwNCh2GtJYKnqqAZHbndvG7WR9TM8a6e7thX+3L2cXlnqss5KwPhU2BwRtuHgmsCV2DGlgiKFpXk2Ai X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47f9031d-d241-435b-f3ed-08dd05643814 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 10:56:55.5569 (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: EHSW7yDLGdLTGpZmpkLI0cvUJ0VHl2NI/hEKvEzhXrNGSYxJjU1d79pyJDvTxAcjnfJVjD1RApQUvTmBWhF6aQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8416 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") Reviewed-by: Frank Li Signed-off-by: Peng Fan --- V3: Add R-b 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 60de1003193a..3966320c3d73 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 Fri Nov 15 10:56:29 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: 13876108 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2077.outbound.protection.outlook.com [40.107.21.77]) (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 D1D3C1B532F for ; Fri, 15 Nov 2024 10:57:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731668223; cv=fail; b=Fx0YLcixYrNQph8/lfmSHg8PoyzJHe6falhdEUCaUp5XyNEkQz45naH4fLgnA2s3UJXutGRJBUso9IoUkz2cL9tlzz5tRu7o8KQ1NtiTTPsxaUESkpHMvw3QavW7vnUDcTmbyaApdqdic2q6YLEB3oEsiIP0mNpxOGnrN17eQ0I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731668223; c=relaxed/simple; bh=rMh79KrAMVkhPQt0GUUHsuB7DhF18En26blPigZDcRM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=pKQfWQxVdQWgt9HNi/bKzgXfDawMvRNNP+PjIsZcVdvbMepjZTfb2zysrdrQ2OudUbweaWBuRDAQi+DW6jOUy1jqoGH/3MvpqOUNFjXvCYEesRlzGXbJ1YrPxUUAnMiwcQVy6a3uyAplU+O/Sl4WiYlFHdlT8iGL/ksx+MCSn90= 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=ir0QuMFP; arc=fail smtp.client-ip=40.107.21.77 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="ir0QuMFP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v6bmKZCM5Gh68crRzQb6tsHngsVhDu2ZgYYPLjaVHHOLtmfaTIBQKSCxSIG/wrIv6sVo540Dg65FUTJCVPwwUOLLB8KV37L5QwW7fPDTnvOvBlmxp7t9krdpH83K3lUz1aFj5hRWYhWZzqa+TrDU33ZEHGjNGBmFNSJVMkiMYKy1N+H3HjeMh9MjGjp5/jVMRLD7GoXM1SsrzNKs2wnchje+zoiDEjSkAZnL7d+VC5bXqQMgKUWuvdxahRRwpmDIPWOoTzPUZ5CNc9kH0BvNsqNLXpcwVkQR0C+evvfUfsw7n+pRoe5OaboFidQmrTKZ1Hwbq5JoG0Wrex6rje1gsQ== 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=q65kXmIixyWranXYOaxt/D1cL8R8/LmZCl6ae/IciN8=; b=pE+3yxqLSqk/DnrpXx+lygoC/1rOQsRD/P9UKfBdcT/CC/cOuXwt0+TbaJdnRM/WBeOMCs39egUZNXOoj/kCSfYErg+R6PutqGUZ5BRU93bEfzlybZPj/KMasU4F0s8xggoOOTxN6YZm4PblRfSSzReZyFNVbAJV1wdrcj/+RTeJWzEsU57yGS5w4NOiAdew5jlnA+vx4u/KUrdRBqpjcM2Z//38bIJDqq0jIarUYbs14+6pBJO6ZbgVQRdSMa9Aw719S3pFD5rHch9jGPrPzL6Yu03TmtvzFFaYF18jAUtvJNEnE0imcFD2nrRRIoeaKNw6GG7EIKbBjIHifZXcnA== 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=q65kXmIixyWranXYOaxt/D1cL8R8/LmZCl6ae/IciN8=; b=ir0QuMFPCJH753Xz0fTyGvDY4Hze2IocpbBWFXJt9TtwIXDz4aVDX/4H7ULUH7G1zMDJ8/KJExrDflI2Jn+/DcRYwpAxKVxdkVrIKuoJ7QtyXHMhdk5P5dgOkWGO+XBHvm8xmDlmQJAFEgXMKo+yyBP5CA2DjoF84LqnlV4dzVDomAILi5IkUcZ2mkVVCsxkpS6AT3Z9KV6O5jtbpKDDl0m/3JXQVA2AMFiNaLbIE5+yj5uvmb/rVArEk3BTwJNHZ2YV0f0wnJ5LITOZY3ls5WftpbxY96PFbUOKX29bDc/DBbhYSy7CvrFpCVHlFxbZr9AZ0RG5JZexhVt1qUbxlw== 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 AM9PR04MB8416.eurprd04.prod.outlook.com (2603:10a6:20b:3b7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Fri, 15 Nov 2024 10:56:59 +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.8158.017; Fri, 15 Nov 2024 10:56:59 +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 V3 2/2] dmaengine: fsl-edma: free irq correctly in remove path Date: Fri, 15 Nov 2024 18:56:29 +0800 Message-Id: <20241115105629.748390-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20241115105629.748390-1-peng.fan@oss.nxp.com> References: <20241115105629.748390-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SI2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::14) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AM9PR04MB8416:EE_ X-MS-Office365-Filtering-Correlation-Id: a7496ac9-e996-4968-a5d3-08dd05643a73 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|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 8t9+MpUBeGPGs6GqmdiBlYuW4iPS1TAqDVmUSBfok5V5yFF5ADN44lj6X6XGBbbIrAYywXkwoHzBV9t1nqxS/PXVjCsi3+MZiH+bFPLVLCjSpEaNpGI3GvdEM+y4gMwzgb6wG/95r4DdhMLuRYxIWo3LrP8dygIhc5TGEMz4ur/RS6o93FfhiBT+Onas/jO5SPwjewK+DTM7UfTcfH0CAQDLryE/lb+Ak1drXork1pqZJMPIDuAGjLF8u0aBoiXwaVXU5paIKUJ/u3fcjniZUQ1D2d1Wl/vuZj0srCARuw2QfkLZzkg4ogSvNPeErE31za8kCvyNLnpYN1ir6hbepfPbBT56Ae4Z52JfPqMep6/c132F+5hb4u/aoPFxSrGZPHV3CvOhR7WfMi3RccboD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.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rU0i9FxphGnhS2soAobiizvmcVfieZw8RLg/T8MZ3PopPrfl4N/hYFmYdNEHAmOaHIETTxWwtmL42rtu/5FvePxl3MXs1Xk3yVKNNnPG5eFf1wm02dP2ie4Ql/tOBoTHUbxE0AprvxInp3doNOgAX+MB438PVbmBqpF3l+dqR2iaDk0fr+tjJpikVpaJVqUoIy9V28zrr80uZY3oRvtG1tEWKQPoo4xnFwt6fCoaEDCiD74bOT5Djbl/UPHLLy5ceaFqOVlL38kX2a4yJXhIqaJtlplt0MCrft+LZzRhxhR9za7DoHEzpZun+WwEdJEgy+6CIi0jrnOZbO5UOjYw+9+MQkmY9ZiKTIXsMarOQMh7xP5KX0RIdivz4SxKY6BCuWsEZP3sTi6t+eGSX3n4BfAoVsfneaIETOoVM5QZiF+n0SvWOPN/FNVZoBJCfll5m3ka9mpOjFXAULd8CGPp3bdaaAR4fcCFSe2qYmbfdIKCc06V91ZJ8ylCpkwkJk850Z+CgpG4px8tEQM8mIypdK9CB/WV19xCR6b/0V3LSHmZWDPSuKSUjFl5AU1UpR89wIAxImqMS7+IGN6okEMm92RPLjBSOz8+l4dOYSihsgux/DEYTmuaerckPdaHtSXn0a62r+g/GJ6qyv1wl/n+iKhMqB+Rx+bnuFy6Ee5RTrUlVJEONg47CdywewIzdCEUF73yUv18/wrtUw1qBuCm59An54b46h1hcZuqZZkGHzn0iyJPHuLWtQCvhgjnOHDXIZXgUCNpXFiVevIDkN9YzcKFC2JFl10u38HcCo+SGgmFbAHOLZoJb0yYwWJVXr9QWfjrWepA1iCf57SzEVqje7HcIczHTUBEp8WmWUXAKQ4ibRxTmezgPMb/EqEgllRg1AUIbk7VhxQIYIb6975PCa2u32iPigmeX0mPd5rGdrk8fBeSlY5brGr39k172iaO86ynOH+rQzMaDvUmaf5Z5+Iipd9uxfCYbyMaf1gmQWT2mNtI/LZ3eLfYZh8PKp+OZil3F4Q55zgTS2+plPeNqAtSBpZa75LsqLaOcgdBkV6ZnpsIQBHelP1t4MLBpmv6vwQE2hQsP209L7lBu8YIJ+3pRBmBnk1EK+LsBWdfHejLIQ37a4/1opSmPn79aCPDYTnVMFY+fnM2K65fNHhcwMbtzGRJDj4RS/UUpMTI3I9hjEDufmZl0oez+HeEpIJSjmi6hPq5DDb8WgxXrUN0Ww5M4uEM8MBQrPN0GTgxoNPtC/aX/8iytl9QuW3Edj6n+CBtrz2RfKbVYbclhKnyXH76hO33afHNfrIpIEja39eRHo6dQQ28F/5JV1PNmduhyJn0zU7mxhidjj+8mri+lvTxf1D92Hge/ATxFGv9qnzcip2QHbDXxHN682vGPisZ0rDTIeIydCupeCtB/iVh/ieH4YZsixdE1DrPj+u0q0xgJwwfhjoIpURrcMjnJ+tzIckCWnjxozkSzSxqgdyc/BUENGQz8UhVkfMtMqTSHA2yU9Oz5AA7Q1uXitn3x3kM6LZd8kSCLcVKJ78z0FuNzjjrF1jc0TS7sDxjfCJjKsfEa32w/RE9Kr2fAqpIT97N X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7496ac9-e996-4968-a5d3-08dd05643a73 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 10:56:59.3145 (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: /5nf/Vj8F6Yzv4MBWmLtOEm0dyTFwnDv11SZha92WiCPP0DgjHggRycV2OLHk4XZmlpioH4Pl8jMUEBaeNnYIw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8416 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. Otherwise there will be kernel dump: WARNING: CPU: 0 PID: 11 at kernel/irq/devres.c:144 devm_free_irq+0x74/0x80 Modules linked in: CPU: 0 UID: 0 PID: 11 Comm: kworker/u8:0 Not tainted 6.12.0-rc7#18 Hardware name: NXP i.MX93 11X11 EVK board (DT) Workqueue: events_unbound deferred_probe_work_func pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : devm_free_irq+0x74/0x80 lr : devm_free_irq+0x48/0x80 Call trace: devm_free_irq+0x74/0x80 (P) devm_free_irq+0x48/0x80 (L) fsl_edma_remove+0xc4/0xc8 platform_remove+0x28/0x44 device_remove+0x4c/0x80 Fixes: 44eb827264de ("dmaengine: fsl-edma: request per-channel IRQ only when channel is allocated") Signed-off-by: Peng Fan Reviewed-by: Frank Li --- V3: Update commit log 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 3966320c3d73..03b684d7358c 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);