[PATCH v2] drm/imx: Remove goto label that are only used once

Liao Yuanhong posted 1 patch 1 month, 4 weeks ago
drivers/gpu/drm/imx/dcss/dcss-drv.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
[PATCH v2] drm/imx: Remove goto label that are only used once
Posted by Liao Yuanhong 1 month, 4 weeks ago
Remove unnecessary goto labels to improve code readability. 

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
Changes in v2:
	Further simplify the return value by using dev_err_probe()
---
 drivers/gpu/drm/imx/dcss/dcss-drv.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/imx/dcss/dcss-drv.c b/drivers/gpu/drm/imx/dcss/dcss-drv.c
index 19b027cc1dc4..51665a9b9533 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-drv.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-drv.c
@@ -37,7 +37,6 @@ static int dcss_drv_platform_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *remote;
 	struct dcss_drv *mdrv;
-	int err = 0;
 	bool hdmi_output = true;
 
 	if (!dev->of_node)
@@ -63,17 +62,11 @@ static int dcss_drv_platform_probe(struct platform_device *pdev)
 
 	mdrv->kms = dcss_kms_attach(mdrv->dcss);
 	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 dev_err_probe(dev, PTR_ERR(mdrv->kms), "Failed to initialize KMS\n");
 	}
 
 	return 0;
-
-dcss_shutoff:
-	dcss_dev_destroy(mdrv->dcss);
-
-	return err;
 }
 
 static void dcss_drv_platform_remove(struct platform_device *pdev)
-- 
2.34.1
Re: [PATCH v2] drm/imx: Remove goto label that are only used once
Posted by Laurentiu Palcu 1 month, 3 weeks ago
On Wed, Aug 06, 2025 at 08:35:45PM +0800, Liao Yuanhong wrote:
> Remove unnecessary goto labels to improve code readability. 
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>

Thanks,
Laurentiu

> ---
> Changes in v2:
> 	Further simplify the return value by using dev_err_probe()
> ---
>  drivers/gpu/drm/imx/dcss/dcss-drv.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/dcss/dcss-drv.c b/drivers/gpu/drm/imx/dcss/dcss-drv.c
> index 19b027cc1dc4..51665a9b9533 100644
> --- a/drivers/gpu/drm/imx/dcss/dcss-drv.c
> +++ b/drivers/gpu/drm/imx/dcss/dcss-drv.c
> @@ -37,7 +37,6 @@ static int dcss_drv_platform_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct device_node *remote;
>  	struct dcss_drv *mdrv;
> -	int err = 0;
>  	bool hdmi_output = true;
>  
>  	if (!dev->of_node)
> @@ -63,17 +62,11 @@ static int dcss_drv_platform_probe(struct platform_device *pdev)
>  
>  	mdrv->kms = dcss_kms_attach(mdrv->dcss);
>  	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 dev_err_probe(dev, PTR_ERR(mdrv->kms), "Failed to initialize KMS\n");
>  	}
>  
>  	return 0;
> -
> -dcss_shutoff:
> -	dcss_dev_destroy(mdrv->dcss);
> -
> -	return err;
>  }
>  
>  static void dcss_drv_platform_remove(struct platform_device *pdev)
> -- 
> 2.34.1
>