From nobody Sun Sep 27 00:40:30 2026 Received: from sg-2-5.ptr.blmpb.com (sg-2-5.ptr.blmpb.com [71.18.227.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C5ED47D440 for ; Thu, 27 Aug 2026 15:43:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=71.18.227.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787845403; cv=none; b=PSzEYotBZVcFw6Y9ml1Y5pXTbMUQFQ/q++OzAKjzJjnqdBQPxkbTQarghMhX3PMbxB3LaiOynpcOfZVglgjjFdk8X4bngIKx2sadrw3FTBwnFEIYR+oK5gfusJWZF1OEiFXXiw0LnEBaYcQ88K0tYFrdpxTLKiGl0Nk7VRcbRXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787845403; c=relaxed/simple; bh=rSxuM1d4cYZHnuQacRlMsdbipcymSj10Y4cSAWHHFcQ=; h=Mime-Version:To:Cc:Subject:Date:In-Reply-To:References: Content-Type:From:Message-Id; b=YHfsc9wNCb3O+voJiBWMGgrQsP4eVNu5lGNMkIyMvRHb6OUoNwVaEZDs4mDSYjL0AZ/yddmKH/cDZYdFNYZJZYFaZDwwbTH+GWEO7FFtDGZuzRNYFN2Jv+1fZOIywx8LlP3GG4jwY4CmN1t57jb9DIOz1L2+GjR7uKNBdfE7mYA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cherr.cc; spf=pass smtp.mailfrom=cherr.cc; dkim=pass (2048-bit key) header.d=cherr.cc header.i=@cherr.cc header.b=cQlOX5YZ; arc=none smtp.client-ip=71.18.227.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cherr.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cherr.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cherr.cc header.i=@cherr.cc header.b="cQlOX5YZ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2604220257; d=cherr.cc; t=1787845393; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=tD7GuzBUX3nmgWtzY2TDrWC7XWIHAdLF+AgXdDtgONY=; b=cQlOX5YZUnsizO0yBXOAmOLHnoBlYJeyupTMPXSqzJvAfekWhSe4tL2abr0QDSV0Db8joO a3SLcT+yY9IW8KdWTpHPSwI9Ym0oPh5gBzjpuyWyE0hoXU/FY3EP++JY3WlXQepbwW7aQh G154Ld2hi7qM3fzvS5aPvEcBZkdT8OMXUFs84DytcSYwrst/+uCnNMYkiloWsUB4xTOuUJ zMeJkPMkRO0LOTUfec+T9c2acwbphfsUOq6fQwQ7DkdTDRFgslzdLgu3/82jTh+T4HNzc3 el/Kmdewud5/DBfrSvUPW8WXeMJ5XJL6d+PFBWWeBdaeAdrBbecQV+fsWI5TjQ== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Original-From: Shengzhuo Wei X-Mailer: b4 0.16.0 To: "Codrin Ciubotariu" , "Andi Shyti" , "Nicolas Ferre" , "Alexandre Belloni" , "Claudiu Beznea" , "Wolfram Sang" , "Ludovic Desroches" , "Oleksij Rempel" , "Pengutronix Kernel Team" , "Frank Li" , "Sascha Hauer" , "Fabio Estevam" , "Yao Yuan" , "Mukesh Kumar Savaliya" , "Viken Dadhaniya" , "Bjorn Andersson" , "Vinod Koul" , "Konrad Dybcio" , "Praveen Talari" Content-Transfer-Encoding: quoted-printable X-Lms-Return-Path: Cc: , , , , , , "Shengzhuo Wei" Subject: [PATCH 1/3] i2c: at91: release DMA channels on remove and probe error Date: Thu, 27 Aug 2026 23:43:01 +0800 Received: from [192.168.9.107] ([111.42.148.163]) by smtp.feishu.cn with ESMTPS; Thu, 27 Aug 2026 23:43:11 +0800 In-Reply-To: <20260827-i2c-dma-channel-leak-v1-0-271d4adc03a0@cherr.cc> References: <20260827-i2c-dma-channel-leak-v1-0-271d4adc03a0@cherr.cc> From: "Shengzhuo Wei" Message-Id: <20260827-i2c-dma-channel-leak-v1-1-271d4adc03a0@cherr.cc> Content-Type: text/plain; charset="utf-8" at91_twi_configure_dma() requests exclusive tx/rx DMA channels, but nothing ever releases them on driver detach, and the probe error path after the channels are acquired (i2c_add_numbered_adapter() failure) returns without releasing them either, because the remove callback is not invoked after a failed probe. Move the release into a helper, call it from the existing configure-failure path, the adapter-registration failure path, and at91_twi_remove(). Fixes: 60937b2cdbf9 ("i2c: at91: add dma support") Cc: stable@vger.kernel.org Signed-off-by: Shengzhuo Wei Assisted-by: GLM:5.3 Acked-by: Mukesh Kumar Savaliya --- drivers/i2c/busses/i2c-at91-core.c | 3 +++ drivers/i2c/busses/i2c-at91-master.c | 12 +++++++++++- drivers/i2c/busses/i2c-at91.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-at91-core.c b/drivers/i2c/busses/i2c-at= 91-core.c index b64adef778d4..8ca4556d9664 100644 --- a/drivers/i2c/busses/i2c-at91-core.c +++ b/drivers/i2c/busses/i2c-at91-core.c @@ -255,6 +255,7 @@ static int at91_twi_probe(struct platform_device *pdev) if (rc) { pm_runtime_disable(dev->dev); pm_runtime_set_suspended(dev->dev); + at91_twi_dma_release(dev); =20 return rc; } @@ -270,6 +271,8 @@ static void at91_twi_remove(struct platform_device *pde= v) =20 i2c_del_adapter(&dev->adapter); =20 + at91_twi_dma_release(dev); + pm_runtime_disable(dev->dev); pm_runtime_set_suspended(dev->dev); } diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-= at91-master.c index 894cedbca99f..68238cc8aee0 100644 --- a/drivers/i2c/busses/i2c-at91-master.c +++ b/drivers/i2c/busses/i2c-at91-master.c @@ -817,11 +817,21 @@ static int at91_twi_configure_dma(struct at91_twi_dev= *dev, u32 phy_addr) error: if (ret !=3D -EPROBE_DEFER) dev_info(dev->dev, "can't get DMA channel, continue without DMA support\= n"); + at91_twi_dma_release(dev); + return ret; +} + +void at91_twi_dma_release(struct at91_twi_dev *dev) +{ + struct at91_twi_dma *dma =3D &dev->dma; + if (dma->chan_rx) dma_release_channel(dma->chan_rx); if (dma->chan_tx) dma_release_channel(dma->chan_tx); - return ret; + dma->chan_rx =3D NULL; + dma->chan_tx =3D NULL; + dev->use_dma =3D false; } =20 static int at91_init_twi_recovery_gpio(struct platform_device *pdev, diff --git a/drivers/i2c/busses/i2c-at91.h b/drivers/i2c/busses/i2c-at91.h index 942e9c3973bb..d68fcbbc3e0f 100644 --- a/drivers/i2c/busses/i2c-at91.h +++ b/drivers/i2c/busses/i2c-at91.h @@ -172,6 +172,7 @@ void at91_twi_irq_restore(struct at91_twi_dev *dev); void at91_init_twi_bus(struct at91_twi_dev *dev); =20 void at91_init_twi_bus_master(struct at91_twi_dev *dev); +void at91_twi_dma_release(struct at91_twi_dev *dev); int at91_twi_probe_master(struct platform_device *pdev, u32 phy_addr, struct at91_twi_dev *dev); =20 --=20 2.47.3 From nobody Sun Sep 27 00:40:30 2026 Received: from sg-2-3.ptr.blmpb.com (sg-2-3.ptr.blmpb.com [71.18.227.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E37C3485CE8 for ; Thu, 27 Aug 2026 15:43:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=71.18.227.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787845405; cv=none; b=iZKWJxhbE7ng0ngAtKOosomWnsxUjRBIj9UHF8hT/8e8Vf63LGYvkHhLfXpJU60WL7oWbdimVom8YOwyRAJ0+fu6SNpAqS1nvuyQ7bjyhPnDyD+fz/HGgnhg6wEZneGbGdYVYOrsv1ZNBaQYp3ibUJbGt4sCV5qd+nbbJz6HpDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787845405; c=relaxed/simple; bh=+M+E2k6W7sbxIgI8b2cThwx7W/ppMQUI5X1TQ9uxJo8=; h=To:Mime-Version:References:Cc:Subject:Content-Type:From:Date: Message-Id:In-Reply-To; b=iimQlv7HxWTbFIuVU4Yvn3R2ZS9+08WHW7UUEpVDqoa2AHmYtCc1qM+Qu+qaTzXhYAwN8J1h4SLMRFG6wVW4zJL9gdu4NwYH/WRPk1ol/0XLRXe8S477pjfVCNzZnY+dr2cGq09kMZUG4giFM9hNQAh4tclL9Y2p+zlt77m+yCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cherr.cc; spf=pass smtp.mailfrom=cherr.cc; dkim=pass (2048-bit key) header.d=cherr.cc header.i=@cherr.cc header.b=spdOKRzX; arc=none smtp.client-ip=71.18.227.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cherr.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cherr.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cherr.cc header.i=@cherr.cc header.b="spdOKRzX" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2604220257; d=cherr.cc; t=1787845396; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=t4JSPZHi9ydke9/rPPt+tNOeEYeI6jSjT/5oE9D+9xI=; b=spdOKRzXbQHQxQh/Y7D8+9kzXcXo4tN2qoGCYbRuYSuSucv0YbkeTMhCrv1WZ2Xc72QQBS 9wAJ1a27Z8tnGiTf6z0Y+e7VWUJi5A3cVlTLmiKwccNnXAyKquy9LJgrZGH5byOM/HI85A c2FqHzjobhy4Oi3LTeg495EO3xNvDLC9IzgY52AdmHCTNYQDDWmtNAzzRUkAAUepHndx1m elT5+TX4BdZn85gbOxT6vc5aG/HEcP0FB0S0kwnA7ymBxxKr7eRmUYZYQKF1AuMCRrWAGL c4gT7U7CTWB1jHWeJclCcEegGXGqLPGFx5VfxIEb8PXDDijlMLRLMzt/jWzgbg== Received: from [192.168.9.107] ([111.42.148.163]) by smtp.feishu.cn with ESMTPS; Thu, 27 Aug 2026 23:43:13 +0800 X-Mailer: b4 0.16.0 To: "Codrin Ciubotariu" , "Andi Shyti" , "Nicolas Ferre" , "Alexandre Belloni" , "Claudiu Beznea" , "Wolfram Sang" , "Ludovic Desroches" , "Oleksij Rempel" , "Pengutronix Kernel Team" , "Frank Li" , "Sascha Hauer" , "Fabio Estevam" , "Yao Yuan" , "Mukesh Kumar Savaliya" , "Viken Dadhaniya" , "Bjorn Andersson" , "Vinod Koul" , "Konrad Dybcio" , "Praveen Talari" X-Lms-Return-Path: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260827-i2c-dma-channel-leak-v1-0-271d4adc03a0@cherr.cc> X-Original-From: Shengzhuo Wei Cc: , , , , , , "Shengzhuo Wei" Subject: [PATCH 2/3] i2c: imx: release DMA channels on probe error From: "Shengzhuo Wei" Date: Thu, 27 Aug 2026 23:43:02 +0800 Content-Transfer-Encoding: quoted-printable Message-Id: <20260827-i2c-dma-channel-leak-v1-2-271d4adc03a0@cherr.cc> In-Reply-To: <20260827-i2c-dma-channel-leak-v1-0-271d4adc03a0@cherr.cc> Content-Type: text/plain; charset="utf-8" i2c_imx_dma_request() acquires exclusive tx/rx DMA channels and is optional: on errors other than -EPROBE_DEFER the driver falls back to PIO mode and probe continues. If i2c_add_numbered_adapter() then fails, probe returns through clk_notifier_unregister without releasing the channels, because the remove callback is not invoked after a failed probe. Release the channels on the probe error path, mirroring i2c_imx_remove(). Fixes: ce1a78840ff7 ("i2c: imx: add DMA support for freescale i2c driver") Cc: stable@vger.kernel.org Signed-off-by: Shengzhuo Wei Assisted-by: GLM:5.3 Reviewed-by: Frank Li --- drivers/i2c/busses/i2c-imx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 19ec056b00af..c24d9201a60e 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1880,6 +1880,8 @@ static int i2c_imx_probe(struct platform_device *pdev) =20 clk_notifier_unregister: clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb); + if (i2c_imx->dma) + i2c_imx_dma_free(i2c_imx); free_irq(irq, i2c_imx); rpm_disable: pm_runtime_put_noidle(&pdev->dev); --=20 2.47.3 From nobody Sun Sep 27 00:40:30 2026 Received: from sg-2-1.ptr.blmpb.com (sg-2-1.ptr.blmpb.com [71.18.227.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F92E485CF7 for ; Thu, 27 Aug 2026 15:43:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=71.18.227.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787845412; cv=none; b=lEKSWWlpO/hJzWpZLUnSNRfSiikpRxIZZbG9T81fNjrxGiB/96QkBqm9UVA/It1mZHMIVWzTleC0GOxSsoeUpE0VzMAuHtTUyCxu2RzKrP7g0ySfQiY2gE+ebMkEZhxYS4pvsHcYqa0P2NNs7iZ/5WKUKAFSK78uPrF6YbV+khw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787845412; c=relaxed/simple; bh=Pg4NFUX8JDPIXbUkkwq0Ml6GLH1igP4ZUMKg6RWzpA8=; h=Content-Type:To:Cc:Mime-Version:Subject:Date:References:From: Message-Id:In-Reply-To; b=fR8cmVPEYFnPY4eDU/TMBLqxJ4e8iDYL5yHphSM05vtlIWNvOK10pkgW7TJeGM1V+q6AUGz29N6BHk5FHjydAft2YyWOONb3GAdNKuAjZUbiWljwzkQNbVAyw3UEqwfJS5fIs5PV37Ohzj3/qcT7pzF5Ae9u3TR1Yi+iRmeHPiw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cherr.cc; spf=pass smtp.mailfrom=cherr.cc; dkim=pass (2048-bit key) header.d=cherr.cc header.i=@cherr.cc header.b=hRfo/+JA; arc=none smtp.client-ip=71.18.227.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cherr.cc Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cherr.cc Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cherr.cc header.i=@cherr.cc header.b="hRfo/+JA" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2604220257; d=cherr.cc; t=1787845398; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=OOFci7YOWRONRU2EkJ/P6bDmKOzzj+GtBTW31kETtbg=; b=hRfo/+JAVjLKlzsS4SxiGLQzJKUn+O/szLDgLqQwnP3IvCNV+IbQ2fL05KaAdvV2GGcRxS V++0JZmCazu9q34jjtknWEhpBZocfYq3PHlCRGn35DXTnDhaXoJwoVq2Lh4eyh7iVmNeJd awasnakxT820dUAVk39gW3DOVsCbPVVadnK7nQZiyY5bzLNaHVUE7+srrDd/WDSPx9pEG2 7mZFGHW795o4atz4ekhVg7j6t7wA3nGVCGbmmRWk3RqBzAMGHIz4SfbiXf6STZPFbbZcel H9fxf4Z/se/OXHinYVASncGItAygVUpRMshhRy4opCMIx5AvWRFgK+GclWQ5bg== To: "Codrin Ciubotariu" , "Andi Shyti" , "Nicolas Ferre" , "Alexandre Belloni" , "Claudiu Beznea" , "Wolfram Sang" , "Ludovic Desroches" , "Oleksij Rempel" , "Pengutronix Kernel Team" , "Frank Li" , "Sascha Hauer" , "Fabio Estevam" , "Yao Yuan" , "Mukesh Kumar Savaliya" , "Viken Dadhaniya" , "Bjorn Andersson" , "Vinod Koul" , "Konrad Dybcio" , "Praveen Talari" Cc: , , , , , , "Shengzhuo Wei" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [PATCH 3/3] i2c: qcom-geni: release DMA channels on probe error Date: Thu, 27 Aug 2026 23:43:03 +0800 X-Mailer: b4 0.16.0 References: <20260827-i2c-dma-channel-leak-v1-0-271d4adc03a0@cherr.cc> X-Lms-Return-Path: From: "Shengzhuo Wei" Message-Id: <20260827-i2c-dma-channel-leak-v1-3-271d4adc03a0@cherr.cc> X-Original-From: Shengzhuo Wei In-Reply-To: <20260827-i2c-dma-channel-leak-v1-0-271d4adc03a0@cherr.cc> Received: from [192.168.9.107] ([111.42.148.163]) by smtp.feishu.cn with ESMTPS; Thu, 27 Aug 2026 23:43:15 +0800 Content-Type: text/plain; charset="utf-8" geni_i2c_init() grabs exclusive GPI tx/rx DMA channels when the serial engine runs in GPI mode. If i2c_add_adapter() subsequently fails, probe returns without releasing the channels, because the remove callback is not invoked after a failed probe. The adapter-registration failure path used to release the channels via its err_dma label; that release was dropped when the probe tail was restructured into geni_i2c_init(). Release the channels on the adapter-registration failure path, mirroring geni_i2c_remove(). Fixes: d8d3bb127ad1 ("i2c: qcom-geni: Isolate serial engine setup") Cc: stable@vger.kernel.org Signed-off-by: Shengzhuo Wei Assisted-by: GLM:5.3 Reviewed-by: Konrad Dybcio Reviewed-by: Mukesh Kumar Savaliya --- drivers/i2c/busses/i2c-qcom-geni.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qc= om-geni.c index 658636c1ee0e..45c770552bd2 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -1189,8 +1189,10 @@ static int geni_i2c_probe(struct platform_device *pd= ev) return ret; =20 ret =3D i2c_add_adapter(&gi2c->adap); - if (ret) + if (ret) { + release_gpi_dma(gi2c); return dev_err_probe(dev, ret, "Error adding i2c adapter\n"); + } =20 dev_dbg(dev, "Geni-I2C adaptor successfully added\n"); =20 --=20 2.47.3