mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: stm32: csi: Omit two variable reassignments in stm32_csi_probe()
@ 2025-10-20 12:38 Markus Elfring
  2025-10-27 15:19 ` Alain Volmat
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2025-10-20 12:38 UTC (permalink / raw)
  To: linux-media, linux-stm32, linux-arm-kernel, Alain Volmat,
	Alexandre Torgue, Hans Verkuil, Mauro Carvalho Chehab,
	Maxime Coquelin
  Cc: LKML, Anand Moon, Christophe Jaillet

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 20 Oct 2025 14:30:06 +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/media/platform/st/stm32/stm32-csi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c
index fd2b6dfbd44c..a997b34a73d7 100644
--- a/drivers/media/platform/st/stm32/stm32-csi.c
+++ b/drivers/media/platform/st/stm32/stm32-csi.c
@@ -1033,8 +1033,7 @@ static int stm32_csi_probe(struct platform_device *pdev)
 
 	ret = reset_control_assert(rstc);
 	if (ret) {
-		ret = dev_err_probe(&pdev->dev, ret,
-				    "Failed to assert the reset line\n");
+		dev_err_probe(&pdev->dev, ret, "Failed to assert the reset line\n");
 		goto err_cleanup;
 	}
 
@@ -1042,8 +1041,7 @@ static int stm32_csi_probe(struct platform_device *pdev)
 
 	ret = reset_control_deassert(rstc);
 	if (ret) {
-		ret = dev_err_probe(&pdev->dev, ret,
-				    "Failed to deassert the reset line\n");
+		dev_err_probe(&pdev->dev, ret, "Failed to deassert the reset line\n");
 		goto err_cleanup;
 	}
 
-- 
2.51.1


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

* Re: [PATCH] media: stm32: csi: Omit two variable reassignments in stm32_csi_probe()
  2025-10-20 12:38 [PATCH] media: stm32: csi: Omit two variable reassignments in stm32_csi_probe() Markus Elfring
@ 2025-10-27 15:19 ` Alain Volmat
  0 siblings, 0 replies; 2+ messages in thread
From: Alain Volmat @ 2025-10-27 15:19 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-media, linux-stm32, linux-arm-kernel, Alexandre Torgue,
	Hans Verkuil, Mauro Carvalho Chehab, Maxime Coquelin, LKML,
	Anand Moon, Christophe Jaillet

Hi Markus,

thanks for this patch.

On Mon, Oct 20, 2025 at 02:38:08PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 20 Oct 2025 14:30:06 +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/media/platform/st/stm32/stm32-csi.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c
> index fd2b6dfbd44c..a997b34a73d7 100644
> --- a/drivers/media/platform/st/stm32/stm32-csi.c
> +++ b/drivers/media/platform/st/stm32/stm32-csi.c
> @@ -1033,8 +1033,7 @@ static int stm32_csi_probe(struct platform_device *pdev)
>  
>  	ret = reset_control_assert(rstc);
>  	if (ret) {
> -		ret = dev_err_probe(&pdev->dev, ret,
> -				    "Failed to assert the reset line\n");
> +		dev_err_probe(&pdev->dev, ret, "Failed to assert the reset line\n");
>  		goto err_cleanup;
>  	}
>  
> @@ -1042,8 +1041,7 @@ static int stm32_csi_probe(struct platform_device *pdev)
>  
>  	ret = reset_control_deassert(rstc);
>  	if (ret) {
> -		ret = dev_err_probe(&pdev->dev, ret,
> -				    "Failed to deassert the reset line\n");
> +		dev_err_probe(&pdev->dev, ret, "Failed to deassert the reset line\n");
>  		goto err_cleanup;
>  	}
>  
> -- 
> 2.51.1
> 

Acked-by: Alain Volmat <alain.volmat@foss.st.com>

Regards,
Alain

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

end of thread, other threads:[~2025-10-27 15:20 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:38 [PATCH] media: stm32: csi: Omit two variable reassignments in stm32_csi_probe() Markus Elfring
2025-10-27 15:19 ` Alain Volmat

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

all inboxes | Powered by JetHome®