From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 8114D277026; Sat, 17 Oct 2026 16:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256054; cv=none; b=tyGINwGMpnFcoyyxcXdSrhi8tZNE6jY/UdXChp+K9GrlJxEMHG7cWJij6uiyyMq8xBw0E19bRh6d0LO6bLBIuplB+lqvtYaaqUgvEc6i/U56Y5ZtKPp+8cRCtPIcbyZAAWyyxdbHlj/ANxRW1Goi1Vpz99ODwcM4RzFAKD7rpV8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256054; c=relaxed/simple; bh=/YbtJIGaOhMqKkAaqXSGVzs6Ictif1YPbzUaoMvSrW4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c6xWqkRZrQLUObihcvFTXbzb94QfxvueHcP8kUxxoQSqxKDBOoRTzoBzzATen87ylKOGbqSofFyBUvdV5B+KSYapYJpkjb+Q4f9JL2/RQPiBXNkgsuPV/uo0Ou495GQP7vL8jWR3BiuIaWilQgvr+IRajJ7IKUTdYeQY/XlGxZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0C5rzeiQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0C5rzeiQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C35A61F000C4; Sat, 17 Oct 2026 16:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792256053; bh=x2L4zb8tyoquPPpRxq21ih3uIPhOc6woWA+DxNISePc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0C5rzeiQIiE1KXG7P3YTBTP0hQXdQr2J8in1jKFczERvYG211fjH5fkfQPVZsMYz8 rAQvSViSaDnEsp45g4vGWEzMebAOMi5iVGFaLkhF3YvI/OFC8QOEPkWVMDQpQUif3n jCNEMPO7zthMo5FfSctdoDATaQq1u7gXmMgDymV0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ruoyu Wang , Frank Li , Andi Shyti , Sasha Levin Subject: [PATCH 6.6 0072/1674] i2c: mxs: fix DMA channel leak on probe error Date: Sat, 17 Oct 2026 17:39:04 +0200 Message-ID: <20261017160432.980608268@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ruoyu Wang [ Upstream commit 777979e627115734052b323d2721cdb500e81dcf ] mxs_i2c_probe() requests an exclusive DMA channel before resetting the controller and registering the I2C adapter. If either later operation fails, probe returns without releasing the channel because the remove callback is not invoked after a failed probe. Use devm_dma_request_chan() so the device core releases the channel on probe failure and driver detach. Remove the manual release from the remove callback because the channel is now device-managed. This issue was found by a static analysis checker and confirmed by manual source review. Fixes: 62885f59a261 ("MXS: Implement DMA support into mxs-i2c") Assisted-by: unnamed:claude-opus-4.8 typestate Signed-off-by: Ruoyu Wang Cc: # v3.7+ Reviewed-by: Frank Li Signed-off-by: Andi Shyti Link: https://patch.msgid.link/20260815151720.3757460-1-ruoyuw560@gmail.com Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-mxs.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 36def0a9c95c4..e3b1ee4c4195f 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -831,7 +831,7 @@ static int mxs_i2c_probe(struct platform_device *pdev) } /* Setup the DMA */ - i2c->dmach = dma_request_chan(dev, "rx-tx"); + i2c->dmach = devm_dma_request_chan(dev, "rx-tx"); if (IS_ERR(i2c->dmach)) { return dev_err_probe(dev, PTR_ERR(i2c->dmach), "Failed to request dma\n"); @@ -869,9 +869,6 @@ static void mxs_i2c_remove(struct platform_device *pdev) i2c_del_adapter(&i2c->adapter); - if (i2c->dmach) - dma_release_channel(i2c->dmach); - writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET); } -- 2.53.0