From: Markus Elfring <Markus.Elfring@web.de>
To: linux-i2c@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
Alain Volmat <alain.volmat@foss.st.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Andi Shyti <andi.shyti@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Pierre-Yves Mordret <pierre-yves.mordret@foss.st.com>,
Wolfram Sang <wsa@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Anand Moon <linux.amoon@gmail.com>,
Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Subject: [PATCH] i2c: stm32: Omit two variable reassignments in stm32_i2c_dma_request()
Date: Mon, 20 Oct 2025 14:00:21 +0200 [thread overview]
Message-ID: <f7e0c023-d2d1-40ba-badb-74a7e9c23684@web.de> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 20 Oct 2025 13:33:12 +0200
An error code was assigned to a variable and checked accordingly.
This value was passed to a dev_err_probe() call in an if branch.
This function is documented in the way that the same value is returned.
Thus delete two redundant variable reassignments.
The source code was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/i2c/busses/i2c-stm32.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c
index f84ec056e36d..becf8977979f 100644
--- a/drivers/i2c/busses/i2c-stm32.c
+++ b/drivers/i2c/busses/i2c-stm32.c
@@ -27,8 +27,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
if (IS_ERR(dma->chan_tx)) {
ret = PTR_ERR(dma->chan_tx);
if (ret != -ENODEV)
- ret = dev_err_probe(dev, ret,
- "can't request DMA tx channel\n");
+ dev_err_probe(dev, ret, "can't request DMA tx channel\n");
+
goto fail_al;
}
@@ -48,8 +48,7 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
if (IS_ERR(dma->chan_rx)) {
ret = PTR_ERR(dma->chan_rx);
if (ret != -ENODEV)
- ret = dev_err_probe(dev, ret,
- "can't request DMA rx channel\n");
+ dev_err_probe(dev, ret, "can't request DMA rx channel\n");
goto fail_tx;
}
--
2.51.1
next reply other threads:[~2025-10-20 12:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 12:00 Markus Elfring [this message]
2025-10-21 22:50 ` [PATCH] i2c: stm32: Omit two variable reassignments in stm32_i2c_dma_request() Andi Shyti
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=f7e0c023-d2d1-40ba-badb-74a7e9c23684@web.de \
--to=markus.elfring@web.de \
--cc=alain.volmat@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andi.shyti@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux.amoon@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=pierre-yves.mordret@foss.st.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