Skip to contentSkip to conversation

backlight: aat2870: remove goto out

PATCH Superseded Jingoo Han 2 participants 2 messages Aug 6, 2012 – Aug 7, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 2/3 backlight: aat2870: remove goto out

This patch removes goto out, which makes code a bit smaller.

Cc Jin Park <[email protected]>
Cc Richard Purdie <[email protected]>
---
 drivers/video/backlight/aat2870_bl.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
drivers/video/backlight/aat2870_bl.c +4 -9
index 7ff7522..619a1e0 100644
@@ -135,14 +135,12 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 
 	if (!pdata) {
 		dev_err(&pdev->dev, "No platform data\n");
-		ret = -ENXIO;
-		goto out;
+		return -ENXIO;
 	}
 
 	if (pdev->id != AAT2870_ID_BL) {
 		dev_err(&pdev->dev, "Invalid device ID, %d\n", pdev->id);
-		ret = -EINVAL;
-		goto out;
+		return -EINVAL;
 	}
 
 	aat2870_bl = devm_kzalloc(&pdev->dev,
@@ -151,8 +149,7 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 	if (!aat2870_bl) {
 		dev_err(&pdev->dev,
 			"Failed to allocate memory for aat2870 backlight\n");
-		ret = -ENOMEM;
-		goto out;
+		return -ENOMEM;
 	}
 
 	memset(&props, 0, sizeof(struct backlight_properties));
@@ -163,8 +160,7 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 	if (IS_ERR(bd)) {
 		dev_err(&pdev->dev,
 			"Failed allocate memory for backlight device\n");
-		ret = PTR_ERR(bd);
-		goto out;
+		return PTR_ERR(bd);
 	}
 
 	aat2870_bl->pdev = pdev;
@@ -201,7 +197,6 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 
 out_bl_dev_unregister:
 	backlight_device_unregister(bd);
-out:
 	return ret;
 }
 
Signature · 1 line
1.7.1
Acked-by on v1 2/3
#1 lore raw

Re-send.

Thanks,
Jinyoung.

Quoted 59 lines · Jingoo Han

This patch removes goto out, which makes code a bit smaller.

Cc Jin Park <[email protected]>
Cc Richard Purdie <[email protected]>
---
  drivers/video/backlight/aat2870_bl.c |   13 ++++---------
  1 files changed, 4 insertions(+), 9 deletions(-)
drivers/video/backlight/aat2870_bl.c +4 -9
index 7ff7522..619a1e0 100644
@@ -135,14 +135,12 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 
  	if (!pdata) {
  		dev_err(&pdev->dev, "No platform data\n");
-		ret = -ENXIO;
-		goto out;
+		return -ENXIO;
  	}
 
  	if (pdev->id != AAT2870_ID_BL) {
  		dev_err(&pdev->dev, "Invalid device ID, %d\n", pdev->id);
-		ret = -EINVAL;
-		goto out;
+		return -EINVAL;
  	}
 
  	aat2870_bl = devm_kzalloc(&pdev->dev,
@@ -151,8 +149,7 @@ static int aat2870_bl_probe(struct platform_device *pdev)
  	if (!aat2870_bl) {
  		dev_err(&pdev->dev,
  			"Failed to allocate memory for aat2870 backlight\n");
-		ret = -ENOMEM;
-		goto out;
+		return -ENOMEM;
  	}
 
  	memset(&props, 0, sizeof(struct backlight_properties));
@@ -163,8 +160,7 @@ static int aat2870_bl_probe(struct platform_device *pdev)
  	if (IS_ERR(bd)) {
  		dev_err(&pdev->dev,
  			"Failed allocate memory for backlight device\n");
-		ret = PTR_ERR(bd);
-		goto out;
+		return PTR_ERR(bd);
  	}
 
  	aat2870_bl->pdev = pdev;
@@ -201,7 +197,6 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 
  out_bl_dev_unregister:
  	backlight_device_unregister(bd);
-out:
  	return ret;
  }