mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/4] drm: Remove goto label that are only used once
@ 2025-08-05  7:46 Liao Yuanhong
  2025-08-05  7:46 ` [PATCH 1/4] drm/i915/gem: " Liao Yuanhong
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Liao Yuanhong @ 2025-08-05  7:46 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Simona Vetter, Frank Binns, Matt Coster,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Laurentiu Palcu, Lucas Stach, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Neil Armstrong,
	Jessica Zhang, Nitin Gote, Krzysztof Niemiec, Liao Yuanhong,
	open list:DRM DRIVERS, open list,
	open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

Remove unnecessary goto labels to improve code readability.

Liao Yuanhong (4):
  drm/i915/gem: Remove goto label that are only used once
  drm/imagination: Remove goto label that are only used once
  drm/imx: Remove goto label that are only used once
  drm/panel: Remove goto label that are only used once

 drivers/gpu/drm/i915/gem/i915_gem_region.c       | 10 ++++------
 drivers/gpu/drm/imagination/pvr_cccb.c           |  8 ++------
 drivers/gpu/drm/imagination/pvr_fw_startstop.c   | 13 +++++--------
 drivers/gpu/drm/imx/dcss/dcss-drv.c              |  8 ++------
 drivers/gpu/drm/panel/panel-innolux-ej030na.c    |  7 ++-----
 drivers/gpu/drm/panel/panel-orisetech-ota5601a.c |  7 ++-----
 6 files changed, 17 insertions(+), 36 deletions(-)

-- 
2.34.1


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

* [PATCH 1/4] drm/i915/gem: Remove goto label that are only used once
  2025-08-05  7:46 [PATCH 0/4] drm: Remove goto label that are only used once Liao Yuanhong
@ 2025-08-05  7:46 ` Liao Yuanhong
  2025-08-05  7:52   ` Jani Nikula
  2025-08-05  7:46 ` [PATCH 2/4] drm/imagination: " Liao Yuanhong
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Liao Yuanhong @ 2025-08-05  7:46 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Simona Vetter, Liao Yuanhong, Nitin Gote,
	Krzysztof Niemiec, open list:DRM DRIVERS, open list

Remove unnecessary goto labels to improve code readability. 

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_region.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_region.c b/drivers/gpu/drm/i915/gem/i915_gem_region.c
index 636768d0f57e..539d1716d454 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_region.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_region.c
@@ -92,15 +92,13 @@ __i915_gem_object_create_region(struct intel_memory_region *mem,
 		flags |= I915_BO_ALLOC_PM_EARLY;
 
 	err = mem->ops->init_object(mem, obj, offset, size, page_size, flags);
-	if (err)
-		goto err_object_free;
+	if (err) {
+		i915_gem_object_free(obj);
+		return ERR_PTR(err);
+	}
 
 	trace_i915_gem_object_create(obj);
 	return obj;
-
-err_object_free:
-	i915_gem_object_free(obj);
-	return ERR_PTR(err);
 }
 
 struct drm_i915_gem_object *
-- 
2.34.1


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

* [PATCH 2/4] drm/imagination: Remove goto label that are only used once
  2025-08-05  7:46 [PATCH 0/4] drm: Remove goto label that are only used once Liao Yuanhong
  2025-08-05  7:46 ` [PATCH 1/4] drm/i915/gem: " Liao Yuanhong
@ 2025-08-05  7:46 ` Liao Yuanhong
  2025-08-05  7:46 ` [PATCH 3/4] drm/imx: " Liao Yuanhong
  2025-08-05  7:46 ` [PATCH 4/4] drm/panel: " Liao Yuanhong
  3 siblings, 0 replies; 7+ messages in thread
From: Liao Yuanhong @ 2025-08-05  7:46 UTC (permalink / raw)
  To: Frank Binns, Matt Coster, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter,
	open list:DRM DRIVERS, open list
  Cc: Liao Yuanhong

Remove unnecessary goto labels to improve code readability. 

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/gpu/drm/imagination/pvr_cccb.c         |  8 ++------
 drivers/gpu/drm/imagination/pvr_fw_startstop.c | 13 +++++--------
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/imagination/pvr_cccb.c b/drivers/gpu/drm/imagination/pvr_cccb.c
index 4fabab41bea7..ed7e1c8fb71b 100644
--- a/drivers/gpu/drm/imagination/pvr_cccb.c
+++ b/drivers/gpu/drm/imagination/pvr_cccb.c
@@ -69,18 +69,14 @@ pvr_cccb_init(struct pvr_device *pvr_dev, struct pvr_cccb *pvr_cccb,
 						      NULL, NULL, &pvr_cccb->cccb_obj);
 	if (IS_ERR(pvr_cccb->cccb)) {
 		err = PTR_ERR(pvr_cccb->cccb);
-		goto err_free_ctrl;
+		pvr_fw_object_unmap_and_destroy(pvr_cccb->ctrl_obj);
+		return err;
 	}
 
 	pvr_fw_object_get_fw_addr(pvr_cccb->ctrl_obj, &pvr_cccb->ctrl_fw_addr);
 	pvr_fw_object_get_fw_addr(pvr_cccb->cccb_obj, &pvr_cccb->cccb_fw_addr);
 
 	return 0;
-
-err_free_ctrl:
-	pvr_fw_object_unmap_and_destroy(pvr_cccb->ctrl_obj);
-
-	return err;
 }
 
 /**
diff --git a/drivers/gpu/drm/imagination/pvr_fw_startstop.c b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
index dcbb9903e791..4921acd4e757 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_startstop.c
+++ b/drivers/gpu/drm/imagination/pvr_fw_startstop.c
@@ -155,8 +155,11 @@ pvr_fw_start(struct pvr_device *pvr_dev)
 		(void)pvr_cr_read64(pvr_dev, ROGUE_CR_SOFT_RESET2);
 
 	err = rogue_slc_init(pvr_dev);
-	if (err)
-		goto err_reset;
+	if (err) {
+		/* Put everything back into soft-reset. */
+		pvr_cr_write64(pvr_dev, ROGUE_CR_SOFT_RESET, soft_reset_mask);
+		return err;
+	}
 
 	/* Initialise Firmware wrapper. */
 	pvr_dev->fw_dev.defs->wrapper_init(pvr_dev);
@@ -185,12 +188,6 @@ pvr_fw_start(struct pvr_device *pvr_dev)
 	}
 
 	return 0;
-
-err_reset:
-	/* Put everything back into soft-reset. */
-	pvr_cr_write64(pvr_dev, ROGUE_CR_SOFT_RESET, soft_reset_mask);
-
-	return err;
 }
 
 /**
-- 
2.34.1


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

* [PATCH 3/4] drm/imx: Remove goto label that are only used once
  2025-08-05  7:46 [PATCH 0/4] drm: Remove goto label that are only used once Liao Yuanhong
  2025-08-05  7:46 ` [PATCH 1/4] drm/i915/gem: " Liao Yuanhong
  2025-08-05  7:46 ` [PATCH 2/4] drm/imagination: " Liao Yuanhong
@ 2025-08-05  7:46 ` Liao Yuanhong
  2025-08-06  7:32   ` Laurentiu Palcu
  2025-08-05  7:46 ` [PATCH 4/4] drm/panel: " Liao Yuanhong
  3 siblings, 1 reply; 7+ messages in thread
From: Liao Yuanhong @ 2025-08-05  7:46 UTC (permalink / raw)
  To: Laurentiu Palcu, Lucas Stach, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	open list:NXP i.MX 8MQ DCSS DRIVER,
	open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	open list
  Cc: Liao Yuanhong

Remove unnecessary goto labels to improve code readability. 

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/gpu/drm/imx/dcss/dcss-drv.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/imx/dcss/dcss-drv.c b/drivers/gpu/drm/imx/dcss/dcss-drv.c
index 19b027cc1dc4..3df060a2f6bf 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-drv.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-drv.c
@@ -65,15 +65,11 @@ static int dcss_drv_platform_probe(struct platform_device *pdev)
 	if (IS_ERR(mdrv->kms)) {
 		err = PTR_ERR(mdrv->kms);
 		dev_err_probe(dev, err, "Failed to initialize KMS\n");
-		goto dcss_shutoff;
+		dcss_dev_destroy(mdrv->dcss);
+		return err;
 	}
 
 	return 0;
-
-dcss_shutoff:
-	dcss_dev_destroy(mdrv->dcss);
-
-	return err;
 }
 
 static void dcss_drv_platform_remove(struct platform_device *pdev)
-- 
2.34.1


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

* [PATCH 4/4] drm/panel: Remove goto label that are only used once
  2025-08-05  7:46 [PATCH 0/4] drm: Remove goto label that are only used once Liao Yuanhong
                   ` (2 preceding siblings ...)
  2025-08-05  7:46 ` [PATCH 3/4] drm/imx: " Liao Yuanhong
@ 2025-08-05  7:46 ` Liao Yuanhong
  3 siblings, 0 replies; 7+ messages in thread
From: Liao Yuanhong @ 2025-08-05  7:46 UTC (permalink / raw)
  To: Neil Armstrong, Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter,
	open list:DRM PANEL DRIVERS, open list
  Cc: Liao Yuanhong

Remove unnecessary goto labels to improve code readability. 

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/gpu/drm/panel/panel-innolux-ej030na.c    | 7 ++-----
 drivers/gpu/drm/panel/panel-orisetech-ota5601a.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-innolux-ej030na.c b/drivers/gpu/drm/panel/panel-innolux-ej030na.c
index f85b7a4cbb42..6779a584bbd8 100644
--- a/drivers/gpu/drm/panel/panel-innolux-ej030na.c
+++ b/drivers/gpu/drm/panel/panel-innolux-ej030na.c
@@ -105,14 +105,11 @@ static int ej030na_prepare(struct drm_panel *panel)
 				     ARRAY_SIZE(ej030na_init_sequence));
 	if (err) {
 		dev_err(dev, "Failed to init registers: %d\n", err);
-		goto err_disable_regulator;
+		regulator_disable(priv->supply);
+		return err;
 	}
 
 	return 0;
-
-err_disable_regulator:
-	regulator_disable(priv->supply);
-	return err;
 }
 
 static int ej030na_unprepare(struct drm_panel *panel)
diff --git a/drivers/gpu/drm/panel/panel-orisetech-ota5601a.c b/drivers/gpu/drm/panel/panel-orisetech-ota5601a.c
index fc87f61d4400..95cf8f36dd09 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-ota5601a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-ota5601a.c
@@ -130,16 +130,13 @@ static int ota5601a_prepare(struct drm_panel *drm_panel)
 				     ARRAY_SIZE(ota5601a_panel_regs));
 	if (err) {
 		dev_err(drm_panel->dev, "Failed to init registers: %d\n", err);
-		goto err_disable_regulator;
+		regulator_disable(panel->supply);
+		return err;
 	}
 
 	msleep(120);
 
 	return 0;
-
-err_disable_regulator:
-	regulator_disable(panel->supply);
-	return err;
 }
 
 static int ota5601a_unprepare(struct drm_panel *drm_panel)
-- 
2.34.1


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

* Re: [PATCH 1/4] drm/i915/gem: Remove goto label that are only used once
  2025-08-05  7:46 ` [PATCH 1/4] drm/i915/gem: " Liao Yuanhong
@ 2025-08-05  7:52   ` Jani Nikula
  0 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2025-08-05  7:52 UTC (permalink / raw)
  To: Liao Yuanhong, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin,
	David Airlie, Simona Vetter, Liao Yuanhong, Nitin Gote,
	Krzysztof Niemiec, open list:DRM DRIVERS, open list

On Tue, 05 Aug 2025, Liao Yuanhong <liaoyuanhong@vivo.com> wrote:
> Remove unnecessary goto labels to improve code readability. 

Please don't. It's fine as it is.

> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_region.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_region.c b/drivers/gpu/drm/i915/gem/i915_gem_region.c
> index 636768d0f57e..539d1716d454 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_region.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_region.c
> @@ -92,15 +92,13 @@ __i915_gem_object_create_region(struct intel_memory_region *mem,
>  		flags |= I915_BO_ALLOC_PM_EARLY;
>  
>  	err = mem->ops->init_object(mem, obj, offset, size, page_size, flags);
> -	if (err)
> -		goto err_object_free;
> +	if (err) {
> +		i915_gem_object_free(obj);
> +		return ERR_PTR(err);
> +	}
>  
>  	trace_i915_gem_object_create(obj);
>  	return obj;
> -
> -err_object_free:
> -	i915_gem_object_free(obj);
> -	return ERR_PTR(err);
>  }
>  
>  struct drm_i915_gem_object *

-- 
Jani Nikula, Intel

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

* Re: [PATCH 3/4] drm/imx: Remove goto label that are only used once
  2025-08-05  7:46 ` [PATCH 3/4] drm/imx: " Liao Yuanhong
@ 2025-08-06  7:32   ` Laurentiu Palcu
  0 siblings, 0 replies; 7+ messages in thread
From: Laurentiu Palcu @ 2025-08-06  7:32 UTC (permalink / raw)
  To: Liao Yuanhong
  Cc: Lucas Stach, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam,
	open list:NXP i.MX 8MQ DCSS DRIVER,
	open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	open list

Hi Liao,

On Tue, Aug 05, 2025 at 03:46:18PM +0800, Liao Yuanhong wrote:
> Remove unnecessary goto labels to improve code readability. 
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
>  drivers/gpu/drm/imx/dcss/dcss-drv.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/dcss/dcss-drv.c b/drivers/gpu/drm/imx/dcss/dcss-drv.c
> index 19b027cc1dc4..3df060a2f6bf 100644
> --- a/drivers/gpu/drm/imx/dcss/dcss-drv.c
> +++ b/drivers/gpu/drm/imx/dcss/dcss-drv.c
> @@ -65,15 +65,11 @@ static int dcss_drv_platform_probe(struct platform_device *pdev)
>  	if (IS_ERR(mdrv->kms)) {
>  		err = PTR_ERR(mdrv->kms);
>  		dev_err_probe(dev, err, "Failed to initialize KMS\n");
> -		goto dcss_shutoff;
> +		dcss_dev_destroy(mdrv->dcss);
> +		return err;

I suppose you can now get rid of 'err' variable and 'return
dev_err_probe()' directly.

Thanks,
Laurentiu

>  	}
>  
>  	return 0;
> -
> -dcss_shutoff:
> -	dcss_dev_destroy(mdrv->dcss);
> -
> -	return err;
>  }
>  
>  static void dcss_drv_platform_remove(struct platform_device *pdev)
> -- 
> 2.34.1
> 

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

end of thread, other threads:[~2025-08-06  7:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-05  7:46 [PATCH 0/4] drm: Remove goto label that are only used once Liao Yuanhong
2025-08-05  7:46 ` [PATCH 1/4] drm/i915/gem: " Liao Yuanhong
2025-08-05  7:52   ` Jani Nikula
2025-08-05  7:46 ` [PATCH 2/4] drm/imagination: " Liao Yuanhong
2025-08-05  7:46 ` [PATCH 3/4] drm/imx: " Liao Yuanhong
2025-08-06  7:32   ` Laurentiu Palcu
2025-08-05  7:46 ` [PATCH 4/4] drm/panel: " Liao Yuanhong

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®