* [PATCH] i2c: tegra: Fix the check during DMA channel release
@ 2023-07-17 15:12 Akhil R
2023-07-17 15:24 ` Thierry Reding
0 siblings, 1 reply; 4+ messages in thread
From: Akhil R @ 2023-07-17 15:12 UTC (permalink / raw)
To: christian.koenig, digetx, jonathanh, ldewangan, linux-i2c,
linux-kernel, linux-tegra, sumit.semwal, thierry.reding, wsa
Cc: akhilrajeev
Check for error and NULL before attempting to release DMA channel.
This, otherwise, was causing panic and crash in kernel when the
dma_chan has an invalid value. The condition occurs during init_dma()
when the dma_request_chan() function returns an error.
Fixes: fcc8a89a1c83 ("i2c: tegra: Share same DMA channel for RX and TX")
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
drivers/i2c/busses/i2c-tegra.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index bcbbf23aa530..636bf340e707 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -427,7 +427,7 @@ static void tegra_i2c_release_dma(struct tegra_i2c_dev *i2c_dev)
i2c_dev->dma_buf = NULL;
}
- if (i2c_dev->dma_chan) {
+ if (!IS_ERR_OR_NULL(i2c_dev->dma_chan)) {
dma_release_channel(i2c_dev->dma_chan);
i2c_dev->dma_chan = NULL;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: tegra: Fix the check during DMA channel release
2023-07-17 15:12 [PATCH] i2c: tegra: Fix the check during DMA channel release Akhil R
@ 2023-07-17 15:24 ` Thierry Reding
2023-08-05 13:01 ` Andi Shyti
0 siblings, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2023-07-17 15:24 UTC (permalink / raw)
To: Akhil R
Cc: christian.koenig, digetx, jonathanh, ldewangan, linux-i2c,
linux-kernel, linux-tegra, sumit.semwal, wsa
[-- Attachment #1: Type: text/plain, Size: 818 bytes --]
On Mon, Jul 17, 2023 at 08:42:40PM +0530, Akhil R wrote:
> Check for error and NULL before attempting to release DMA channel.
>
> This, otherwise, was causing panic and crash in kernel when the
> dma_chan has an invalid value. The condition occurs during init_dma()
> when the dma_request_chan() function returns an error.
>
> Fixes: fcc8a89a1c83 ("i2c: tegra: Share same DMA channel for RX and TX")
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> ---
> drivers/i2c/busses/i2c-tegra.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
There's already another patch on the list that should address this:
https://patchwork.ozlabs.org/project/linux-tegra/patch/20230707132619.2998382-1-thierry.reding@gmail.com/
Can you please test and provide feedback on that one?
Thanks,
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: tegra: Fix the check during DMA channel release
2023-07-17 15:24 ` Thierry Reding
@ 2023-08-05 13:01 ` Andi Shyti
2023-08-06 14:26 ` Akhil R
0 siblings, 1 reply; 4+ messages in thread
From: Andi Shyti @ 2023-08-05 13:01 UTC (permalink / raw)
To: Thierry Reding
Cc: Akhil R, christian.koenig, digetx, jonathanh, ldewangan,
linux-i2c, linux-kernel, linux-tegra, sumit.semwal, wsa
Hi Thierry and Akhil,
On Mon, Jul 17, 2023 at 05:24:15PM +0200, Thierry Reding wrote:
> On Mon, Jul 17, 2023 at 08:42:40PM +0530, Akhil R wrote:
> > Check for error and NULL before attempting to release DMA channel.
> >
> > This, otherwise, was causing panic and crash in kernel when the
> > dma_chan has an invalid value. The condition occurs during init_dma()
> > when the dma_request_chan() function returns an error.
> >
> > Fixes: fcc8a89a1c83 ("i2c: tegra: Share same DMA channel for RX and TX")
> > Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> > ---
> > drivers/i2c/busses/i2c-tegra.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
I guess this patch is not needed anymore.
Andi
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] i2c: tegra: Fix the check during DMA channel release
2023-08-05 13:01 ` Andi Shyti
@ 2023-08-06 14:26 ` Akhil R
0 siblings, 0 replies; 4+ messages in thread
From: Akhil R @ 2023-08-06 14:26 UTC (permalink / raw)
To: Andi Shyti, Thierry Reding
Cc: christian.koenig@amd.com, digetx@gmail.com, Jonathan Hunter,
Laxman Dewangan, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
sumit.semwal@linaro.org, wsa@kernel.org
> Hi Thierry and Akhil,
>
> On Mon, Jul 17, 2023 at 05:24:15PM +0200, Thierry Reding wrote:
> > On Mon, Jul 17, 2023 at 08:42:40PM +0530, Akhil R wrote:
> > > Check for error and NULL before attempting to release DMA channel.
> > >
> > > This, otherwise, was causing panic and crash in kernel when the
> > > dma_chan has an invalid value. The condition occurs during
> > > init_dma() when the dma_request_chan() function returns an error.
> > >
> > > Fixes: fcc8a89a1c83 ("i2c: tegra: Share same DMA channel for RX and
> > > TX")
> > > Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> > > ---
> > > drivers/i2c/busses/i2c-tegra.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> I guess this patch is not needed anymore.
Correct. This can be discarded.
The below patch from Thierry is for the same fix.
https://lore.kernel.org/linux-i2c/20230707132619.2998382-1-thierry.reding@gmail.com/
Regards,
Akhil
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-06 14:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 15:12 [PATCH] i2c: tegra: Fix the check during DMA channel release Akhil R
2023-07-17 15:24 ` Thierry Reding
2023-08-05 13:01 ` Andi Shyti
2023-08-06 14:26 ` Akhil R
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).