Skip to content

Commit b4cc818

Browse files
elfringAndi Shyti
authored andcommitted
i2c: stm32: Omit two variable reassignments in stm32_i2c_dma_request()
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> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/f7e0c023-d2d1-40ba-badb-74a7e9c23684@web.de
1 parent acff9f2 commit b4cc818

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/i2c/busses/i2c-stm32.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
2727
if (IS_ERR(dma->chan_tx)) {
2828
ret = PTR_ERR(dma->chan_tx);
2929
if (ret != -ENODEV)
30-
ret = dev_err_probe(dev, ret,
31-
"can't request DMA tx channel\n");
30+
dev_err_probe(dev, ret, "can't request DMA tx channel\n");
31+
3232
goto fail_al;
3333
}
3434

@@ -48,8 +48,7 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev,
4848
if (IS_ERR(dma->chan_rx)) {
4949
ret = PTR_ERR(dma->chan_rx);
5050
if (ret != -ENODEV)
51-
ret = dev_err_probe(dev, ret,
52-
"can't request DMA rx channel\n");
51+
dev_err_probe(dev, ret, "can't request DMA rx channel\n");
5352

5453
goto fail_tx;
5554
}

0 commit comments

Comments
 (0)