mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: sm750fb: remove unnecessary goto
@ 2026-10-25 13:02 Haasham Khan
  2026-10-25 13:58 ` Dan Carpenter
  2026-10-25 16:26 ` [PATCH v2] " Haasham Khan
  0 siblings, 2 replies; 4+ messages in thread
From: Haasham Khan @ 2026-10-25 13:02 UTC (permalink / raw)
  To: sudipm.mukherjee
  Cc: teddy.wang, gregkh, linux-fbdev, linux-staging, linux-kernel,
	Haasham Khan

The error path in hw_sm750_crtc_set_mode() jumps to a label that
immediately returns ret. Return directly and remove the unnecessary
label.

Signed-off-by: Haasham Khan <haasham93@gmail.com>
---
 drivers/staging/sm750fb/sm750_hw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index c4358d3e5091..22f93277e91b 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -272,7 +272,7 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
 	ret = ddk750_set_mode_timing(&modparm, clock);
 	if (ret) {
 		dev_err(&sm750_dev->pdev->dev, "Set mode timing failed\n");
-		goto exit;
+		return ret;
 	}
 
 	if (crtc->channel != sm750_secondary) {
@@ -332,7 +332,6 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
 		poke32(CRT_DISPLAY_CTRL, reg);
 	}
 
-exit:
 	return ret;
 }
 
-- 
2.53.0


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

* Re: [PATCH] staging: sm750fb: remove unnecessary goto
  2026-10-25 13:02 [PATCH] staging: sm750fb: remove unnecessary goto Haasham Khan
@ 2026-10-25 13:58 ` Dan Carpenter
  2026-10-25 16:26 ` [PATCH v2] " Haasham Khan
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-10-25 13:58 UTC (permalink / raw)
  To: Haasham Khan
  Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
	linux-kernel

On Sun, Oct 25, 2026 at 01:02:58PM +0000, Haasham Khan wrote:
> The error path in hw_sm750_crtc_set_mode() jumps to a label that
> immediately returns ret. Return directly and remove the unnecessary
> label.
> 
> Signed-off-by: Haasham Khan <haasham93@gmail.com>
> ---
>  drivers/staging/sm750fb/sm750_hw.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
> index c4358d3e5091..22f93277e91b 100644
> --- a/drivers/staging/sm750fb/sm750_hw.c
> +++ b/drivers/staging/sm750fb/sm750_hw.c
> @@ -272,7 +272,7 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
>  	ret = ddk750_set_mode_timing(&modparm, clock);
>  	if (ret) {
>  		dev_err(&sm750_dev->pdev->dev, "Set mode timing failed\n");
> -		goto exit;
> +		return ret;
>  	}
>  
>  	if (crtc->channel != sm750_secondary) {
> @@ -332,7 +332,6 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
>  		poke32(CRT_DISPLAY_CTRL, reg);
>  	}
>  
> -exit:
>  	return ret;

Change this to "return 0;"

regards,
dan carpenter


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

* [PATCH v2] staging: sm750fb: remove unnecessary goto
  2026-10-25 13:02 [PATCH] staging: sm750fb: remove unnecessary goto Haasham Khan
  2026-10-25 13:58 ` Dan Carpenter
@ 2026-10-25 16:26 ` Haasham Khan
  2026-10-25 18:19   ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Haasham Khan @ 2026-10-25 16:26 UTC (permalink / raw)
  To: sudipm.mukherjee
  Cc: teddy.wang, gregkh, linux-fbdev, linux-staging, linux-kernel,
	Haasham Khan

Return directly when setting the mode timing fails, rather than
jumping to a label that only returns ret. Return 0 on the successful
path.

Signed-off-by: Haasham Khan <haasham93@gmail.com>
---

Changes in v2:
- Return 0 on the successful path, as suggested by Dan Carpenter.
 drivers/staging/sm750fb/sm750_hw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index c4358d3e5091..4dfa1cb6b352 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -272,7 +272,7 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
 	ret = ddk750_set_mode_timing(&modparm, clock);
 	if (ret) {
 		dev_err(&sm750_dev->pdev->dev, "Set mode timing failed\n");
-		goto exit;
+		return ret;
 	}
 
 	if (crtc->channel != sm750_secondary) {
@@ -332,8 +332,7 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
 		poke32(CRT_DISPLAY_CTRL, reg);
 	}
 
-exit:
-	return ret;
+	return 0;
 }
 
 int hw_sm750_set_col_reg(struct lynxfb_crtc *crtc, ushort index, ushort red,
-- 
2.53.0


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

* Re: [PATCH v2] staging: sm750fb: remove unnecessary goto
  2026-10-25 16:26 ` [PATCH v2] " Haasham Khan
@ 2026-10-25 18:19   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-10-25 18:19 UTC (permalink / raw)
  To: Haasham Khan
  Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
	linux-kernel

On Sun, Oct 25, 2026 at 04:26:32PM +0000, Haasham Khan wrote:
> Return directly when setting the mode timing fails, rather than
> jumping to a label that only returns ret. Return 0 on the successful
> path.
> 
> Signed-off-by: Haasham Khan <haasham93@gmail.com>
> ---
> 
> Changes in v2:
> - Return 0 on the successful path, as suggested by Dan Carpenter.

Thanks!

Reviewed-by: Dan Carpenter <error27@gmail.com>

regards,
dan carpenter


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

end of thread, other threads:[~2026-10-25 18:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25 13:02 [PATCH] staging: sm750fb: remove unnecessary goto Haasham Khan
2026-10-25 13:58 ` Dan Carpenter
2026-10-25 16:26 ` [PATCH v2] " Haasham Khan
2026-10-25 18:19   ` Dan Carpenter

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®