public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: stm32: Omit two variable reassignments in stm32_i2c_dma_request()
@ 2025-10-20 12:00 Markus Elfring
  2025-10-21 22:50 ` Andi Shyti
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2025-10-20 12:00 UTC (permalink / raw)
  To: linux-i2c, linux-stm32, linux-arm-kernel, Alain Volmat,
	Alexandre Torgue, Andi Shyti, Krzysztof Kozlowski,
	Maxime Coquelin, Pierre-Yves Mordret, Wolfram Sang
  Cc: LKML, Anand Moon, Christophe Jaillet

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: stm32: Omit two variable reassignments in stm32_i2c_dma_request()
  2025-10-20 12:00 [PATCH] i2c: stm32: Omit two variable reassignments in stm32_i2c_dma_request() Markus Elfring
@ 2025-10-21 22:50 ` Andi Shyti
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Shyti @ 2025-10-21 22:50 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-i2c, linux-stm32, linux-arm-kernel, Alain Volmat,
	Alexandre Torgue, Krzysztof Kozlowski, Maxime Coquelin,
	Pierre-Yves Mordret, Wolfram Sang, LKML, Anand Moon,
	Christophe Jaillet

Hi Markus,

> 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>

merged to i2c/i2c-host.

Thanks,
Andi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-21 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 12:00 [PATCH] i2c: stm32: Omit two variable reassignments in stm32_i2c_dma_request() Markus Elfring
2025-10-21 22:50 ` Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox