From nobody Fri Oct 3 08:51:15 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 1024E3054D6 for ; Wed, 3 Sep 2025 13:06:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756904789; cv=none; b=D2esa2lnkNgjE5nhWD943uAqk/GnRCqowCHRT4Grch3OGSI6i3Q+t+NJfkG0RVlEvPm9ASEJDVIjGFAPAYSi+OGB7hT7Rh2CHOgkmHchx/YfFqCvSlkC2krsNu5xltagubzB7sAw+7E+srXxwISyGI5q3qRLYVn/lwcsi2EdT40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756904789; c=relaxed/simple; bh=XDKPHV75wgIjXXUhw4V5YtDkPybmhaqtXj422XNlmpk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i7TWyyds3hFVGGjIU6hbW1wI5TKRgwjxE6+A2UunT8o8ZbSNcdoWvVxHHi2d9fz4WsM7Mv7mM/3MbnhCdxD0kdcfiacN2PVL1oiytuIdVs5Nc9vT9fu2zC2gD0Xfg37/1Oo8Rpg3grxFVnOmJZxetv45MC4BkudoZqptcDZV2yE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1utnBm-00006Z-1K; Wed, 03 Sep 2025 15:06:14 +0200 From: Marco Felsch Date: Wed, 03 Sep 2025 15:06:18 +0200 Subject: [PATCH 10/11] dmaengine: imx-sdma: drop remove callback Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250903-v6-16-topic-sdma-v1-10-ac7bab629e8b@pengutronix.de> References: <20250903-v6-16-topic-sdma-v1-0-ac7bab629e8b@pengutronix.de> In-Reply-To: <20250903-v6-16-topic-sdma-v1-0-ac7bab629e8b@pengutronix.de> To: Vinod Koul , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Jiada Wang Cc: dmaengine@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Marco Felsch X-Mailer: b4 0.14.2 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org The whole driver was converted to the devm APIs except for this last for-loop. This loop is buggy due to three reasons: 1) It removes the channels without removing the users first. This can lead to very bad situations. 2) The loop starts at 0 and which is channel0 which is a special control channel not registered via vchan_init(). Therefore the remove() always Oops because of NULL pointer exception. 3) sdma_free_chan_resources() disable the clks unconditional without checking if the clks are enabled. This is done for all MAX_DMA_CHANNELS which hang the system if there is at least one unused channel. Since the dmaengine core supports devlinks we already addressed the first issue. The devlink support also addresses the third issue because during the consumer teardown phase each requested channel is dropped accordingly so the dmaengine driver doesn't need to this. The second issue is fixed by not doing anything on channel0. To sum-up, all issues are fixed by dropping the .remove() callback and let the frameworks do their job. Signed-off-by: Marco Felsch Reviewed-by: Frank Li --- drivers/dma/imx-sdma.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 6c6d38b202dd2deffc36b1bd27bc7c60de3d7403..c31785977351163d6fddf4d8b2f= 90dfebb508400 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -2405,25 +2405,11 @@ static int sdma_probe(struct platform_device *pdev) return 0; } =20 -static void sdma_remove(struct platform_device *pdev) -{ - struct sdma_engine *sdma =3D platform_get_drvdata(pdev); - int i; - - /* Kill the tasklet */ - for (i =3D 0; i < MAX_DMA_CHANNELS; i++) { - struct sdma_channel *sdmac =3D &sdma->channel[i]; - - sdma_free_chan_resources(&sdmac->vc.chan); - } -} - static struct platform_driver sdma_driver =3D { .driver =3D { .name =3D "imx-sdma", .of_match_table =3D sdma_dt_ids, }, - .remove =3D sdma_remove, .probe =3D sdma_probe, }; =20 --=20 2.47.2