Skip to contentSkip to conversation

regulator: max77650: Fix set_current_limit implementation

PATCH In review Axel Lin 2 participants 2 messages Feb 22, 2019

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: max77650: Fix set_current_limit implementation

Current code always return error, fix it.

---
 drivers/regulator/max77650-regulator.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/regulator/max77650-regulator.c +2 -4
index 411912d5278b..a1af414db751 100644
@@ -243,7 +243,7 @@ static int max77650_regulator_set_current_limit(struct regulator_dev *rdev,
 {
 	struct max77650_regulator_desc *rdesc;
 	struct regmap *map;
-	int rv, i, limit;
+	int i, limit;
 
 	rdesc = rdev_get_drvdata(rdev);
 	map = rdev_get_regmap(rdev);
@@ -252,11 +252,9 @@ static int max77650_regulator_set_current_limit(struct regulator_dev *rdev,
 		limit = max77650_current_limit_table[i];
 
 		if (limit >= min_uA && limit <= max_uA) {
-			rv = regmap_update_bits(map, rdesc->regA,
+			return regmap_update_bits(map, rdesc->regA,
 					MAX77650_REGULATOR_CURR_LIM_MASK,
 					MAX77650_REGULATOR_CURR_LIM_SHIFT(i));
-			if (rv)
-				return rv;
 		}
 	}
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

pt., 22 lut 2019 o 10:09 Axel Lin <[email protected]> napisał(a):

Quoted 35 lines

Current code always return error, fix it.

---
 drivers/regulator/max77650-regulator.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/regulator/max77650-regulator.c +2 -5
index 411912d5278b..a1af414db751 100644
@@ -243,7 +243,7 @@ static int max77650_regulator_set_current_limit(struct regulator_dev *rdev,
 {
        struct max77650_regulator_desc *rdesc;
        struct regmap *map;
-       int rv, i, limit;
+       int i, limit;
 
        rdesc = rdev_get_drvdata(rdev);
        map = rdev_get_regmap(rdev);
@@ -252,11 +252,9 @@ static int max77650_regulator_set_current_limit(struct regulator_dev *rdev,
                limit = max77650_current_limit_table[i];
 
                if (limit >= min_uA && limit <= max_uA) {
-                       rv = regmap_update_bits(map, rdesc->regA,
+                       return regmap_update_bits(map, rdesc->regA,
                                        MAX77650_REGULATOR_CURR_LIM_MASK,
                                        MAX77650_REGULATOR_CURR_LIM_SHIFT(i));
-                       if (rv)
-                               return rv;
                }
        }
 
--
Quoted 2 lines

2.17.1

Thanks for spotting that!