Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b29c7690 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

regulator: Simplify regulator_bulk_get and regulator_bulk_enable error paths



Start unwind from the point the error happens instead of iterating over all
consumers, then unwind code can be simpler.

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent fde297bb
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -2397,7 +2397,7 @@ int regulator_bulk_get(struct device *dev, int num_consumers,
	return 0;

err:
	for (i = 0; i < num_consumers && consumers[i].consumer; i++)
	while (--i >= 0)
		regulator_put(consumers[i].consumer);

	return ret;
@@ -2447,12 +2447,9 @@ int regulator_bulk_enable(int num_consumers,
	return 0;

err:
	for (i = 0; i < num_consumers; i++)
		if (consumers[i].ret == 0)
	pr_err("Failed to enable %s: %d\n", consumers[i].supply, ret);
	while (--i >= 0)
		regulator_disable(consumers[i].consumer);
		else
			pr_err("Failed to enable %s: %d\n",
			       consumers[i].supply, consumers[i].ret);

	return ret;
}