[PATCH] i2c: designware: Omit a variable reassignment in dw_i2c_plat_probe()

Markus Elfring posted 1 patch 3 months, 2 weeks ago
drivers/i2c/busses/i2c-designware-platdrv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] i2c: designware: Omit a variable reassignment in dw_i2c_plat_probe()
Posted by Markus Elfring 3 months, 2 weeks ago
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 20 Oct 2025 12:56:39 +0200
Subject: [PATCH] i2c: designware: Omit a variable reassignment in dw_i2c_plat_probe()

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 a redundant variable reassignment.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 34d881572351..c69ef8da22ab 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -248,7 +248,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 
 	ret = i2c_dw_probe_lock_support(dev);
 	if (ret) {
-		ret = dev_err_probe(device, ret, "failed to probe lock support\n");
+		dev_err_probe(device, ret, "failed to probe lock support\n");
 		goto exit_reset;
 	}
 
-- 
2.51.1
Re: [PATCH] i2c: designware: Omit a variable reassignment in dw_i2c_plat_probe()
Posted by Andi Shyti 3 months, 2 weeks ago
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 a redundant variable reassignment.
> 
> 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
Re: [PATCH] i2c: designware: Omit a variable reassignment in dw_i2c_plat_probe()
Posted by Anand Moon 3 months, 2 weeks ago
Hi Markus

On Mon, 20 Oct 2025 at 16:39, Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 20 Oct 2025 12:56:39 +0200
> Subject: [PATCH] i2c: designware: Omit a variable reassignment in dw_i2c_plat_probe()
>
> 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 a redundant variable reassignment.
>
> The source code was transformed by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Reviewed-by: Anand Moon <linux.amoon@gmail.com>

Thanks
-Anand
Re: [PATCH] i2c: designware: Omit a variable reassignment in dw_i2c_plat_probe()
Posted by Mika Westerberg 3 months, 2 weeks ago
On Mon, Oct 20, 2025 at 01:08:53PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 20 Oct 2025 12:56:39 +0200
> Subject: [PATCH] i2c: designware: Omit a variable reassignment in dw_i2c_plat_probe()
> 
> 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 a redundant variable reassignment.
> 
> The source code was transformed by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>