From: Akhil R <akhilrajeev@nvidia.com>
To: <christian.koenig@amd.com>, <digetx@gmail.com>,
<jonathanh@nvidia.com>, <ldewangan@nvidia.com>,
<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-tegra@vger.kernel.org>, <sumit.semwal@linaro.org>,
<thierry.reding@gmail.com>, <wsa@kernel.org>
Cc: <akhilrajeev@nvidia.com>
Subject: [PATCH] i2c: tegra: Fix the check during DMA channel release
Date: Mon, 17 Jul 2023 20:42:40 +0530 [thread overview]
Message-ID: <20230717151240.68899-1-akhilrajeev@nvidia.com> (raw)
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
next reply other threads:[~2023-07-17 15:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 15:12 Akhil R [this message]
2023-07-17 15:24 ` [PATCH] i2c: tegra: Fix the check during DMA channel release Thierry Reding
2023-08-05 13:01 ` Andi Shyti
2023-08-06 14:26 ` Akhil R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230717151240.68899-1-akhilrajeev@nvidia.com \
--to=akhilrajeev@nvidia.com \
--cc=christian.koenig@amd.com \
--cc=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=thierry.reding@gmail.com \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).