Skip to contentSkip to conversation

regulator: ab8500-ext: Make the return type of ab8500_ext_regulator_exit() void

PATCH Applied Axel Lin 3 participants 5 messages Apr 11, 2013 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 regulator: ab8500-ext: Make the return type of ab8500_ext_regulator_exit() void

ab8500_ext_regulator_exit() never fails.

---
 drivers/regulator/ab8500-ext.c   |    4 +---
 drivers/regulator/ab8500.c       |    9 +++------
 include/linux/regulator/ab8500.h |    2 +-
 3 files changed, 5 insertions(+), 10 deletions(-)
drivers/regulator/ab8500-ext.c +1 -3
index dd582be..861ab04 100644
@@ -385,7 +385,7 @@ int ab8500_ext_regulator_init(struct platform_device *pdev)
 	return 0;
 }
 
-int ab8500_ext_regulator_exit(struct platform_device *pdev)
+void ab8500_ext_regulator_exit(struct platform_device *pdev)
 {
 	int i;
 
@@ -398,8 +398,6 @@ int ab8500_ext_regulator_exit(struct platform_device *pdev)
 
 		regulator_unregister(info->rdev);
 	}
-
-	return 0;
 }
 
 MODULE_LICENSE("GPL v2");
drivers/regulator/ab8500.c +3 -6
index 9ebd131..c200f8b 100644
@@ -3194,12 +3194,9 @@ static int ab8500_regulator_remove(struct platform_device *pdev)
 		regulator_unregister(info->regulator);
 	}
 
-	if (!is_ab8505(ab8500)) {
-		/* remove external regulators (after Vaux1, 2 and 3) */
-		err = ab8500_ext_regulator_exit(pdev);
-		if (err)
-			return err;
-	}
+	/* remove external regulators (after Vaux1, 2 and 3) */
+	if (!is_ab8505(ab8500))
+		ab8500_ext_regulator_exit(pdev);
 
 	/* remove regulator debug */
 	err = ab8500_regulator_debug_exit(pdev);
include/linux/regulator/ab8500.h +1 -1
index 90b8b5a..7c5ff0c 100644
@@ -338,6 +338,6 @@ static inline int ab8500_regulator_debug_exit(struct platform_device *pdev)
 
 /* AB8500 external regulator functions. */
 int ab8500_ext_regulator_init(struct platform_device *pdev);
-int ab8500_ext_regulator_exit(struct platform_device *pdev);
+void ab8500_ext_regulator_exit(struct platform_device *pdev);
 
 #endif
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH 2/2 regulator: ab8500: Unregister ab8500-ext regulators in probe() failure path

---
 drivers/regulator/ab8500.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/regulator/ab8500.c +4 -1
index c200f8b..ea182d3 100644
@@ -3172,8 +3172,11 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
 	for (i = 0; i < abx500_regulator.info_size; i++) {
 		err = ab8500_regulator_register(pdev, &pdata->regulator[i],
 						i, NULL);
-		if (err < 0)
+		if (err < 0) {
+			if (!is_ab8505(ab8500))
+				ab8500_ext_regulator_exit(pdev);
 			return err;
+		}
 	}
 
 	return 0;
Signature · 1 line
1.7.10.4
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] regulator: ab8500: Unregister ab8500-ext regulators in probe() failure path

Quoted 1 line · Axel Lin

Looks good to me.

Quoted 21 lines
---
  drivers/regulator/ab8500.c |    5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/regulator/ab8500.c +4 -1
index c200f8b..ea182d3 100644
@@ -3172,8 +3172,11 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
  	for (i = 0; i < abx500_regulator.info_size; i++) {
  		err = ab8500_regulator_register(pdev, &pdata->regulator[i],
  						i, NULL);
-		if (err < 0)
+		if (err < 0) {
+			if (!is_ab8505(ab8500))
+				ab8500_ext_regulator_exit(pdev);
  			return err;
+		}
  	}
 
  	return 0;
Acked-by on v1 1/2
#3 lore raw
In reply to Axel Lin
Quoted 3 lines · Axel Lin

ab8500_ext_regulator_exit() never fails.

Looks good to me.

Quoted 60 lines
---
  drivers/regulator/ab8500-ext.c   |    4 +---
  drivers/regulator/ab8500.c       |    9 +++------
  include/linux/regulator/ab8500.h |    2 +-
  3 files changed, 5 insertions(+), 10 deletions(-)
drivers/regulator/ab8500-ext.c +1 -3
index dd582be..861ab04 100644
@@ -385,7 +385,7 @@ int ab8500_ext_regulator_init(struct platform_device *pdev)
  	return 0;
  }
 
-int ab8500_ext_regulator_exit(struct platform_device *pdev)
+void ab8500_ext_regulator_exit(struct platform_device *pdev)
  {
  	int i;
 
@@ -398,8 +398,6 @@ int ab8500_ext_regulator_exit(struct platform_device *pdev)
 
  		regulator_unregister(info->rdev);
  	}
-
-	return 0;
  }
 
  MODULE_LICENSE("GPL v2");
drivers/regulator/ab8500.c +3 -6
index 9ebd131..c200f8b 100644
@@ -3194,12 +3194,9 @@ static int ab8500_regulator_remove(struct platform_device *pdev)
  		regulator_unregister(info->regulator);
  	}
 
-	if (!is_ab8505(ab8500)) {
-		/* remove external regulators (after Vaux1, 2 and 3) */
-		err = ab8500_ext_regulator_exit(pdev);
-		if (err)
-			return err;
-	}
+	/* remove external regulators (after Vaux1, 2 and 3) */
+	if (!is_ab8505(ab8500))
+		ab8500_ext_regulator_exit(pdev);
 
  	/* remove regulator debug */
  	err = ab8500_regulator_debug_exit(pdev);
include/linux/regulator/ab8500.h +1 -1
index 90b8b5a..7c5ff0c 100644
@@ -338,6 +338,6 @@ static inline int ab8500_regulator_debug_exit(struct platform_device *pdev)
 
  /* AB8500 external regulator functions. */
  int ab8500_ext_regulator_init(struct platform_device *pdev);
-int ab8500_ext_regulator_exit(struct platform_device *pdev);
+void ab8500_ext_regulator_exit(struct platform_device *pdev);
 
  #endif