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

Commit 0be9653a authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown
Browse files

ASoC: wm8804: Use new devres regulator_register_notifier



This is more idiomatic and also fixes an issue where the notifiers were
being leaked if probe failed.

Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5142442d
Loading
Loading
Loading
Loading
+4 −11
Original line number Original line Diff line number Diff line
@@ -601,7 +601,9 @@ int wm8804_probe(struct device *dev, struct regmap *regmap)


	/* This should really be moved into the regulator core */
	/* This should really be moved into the regulator core */
	for (i = 0; i < ARRAY_SIZE(wm8804->supplies); i++) {
	for (i = 0; i < ARRAY_SIZE(wm8804->supplies); i++) {
		ret = regulator_register_notifier(wm8804->supplies[i].consumer,
		struct regulator *regulator = wm8804->supplies[i].consumer;

		ret = devm_regulator_register_notifier(regulator,
						       &wm8804->disable_nb[i]);
						       &wm8804->disable_nb[i]);
		if (ret != 0) {
		if (ret != 0) {
			dev_err(dev,
			dev_err(dev,
@@ -662,15 +664,6 @@ EXPORT_SYMBOL_GPL(wm8804_probe);


void wm8804_remove(struct device *dev)
void wm8804_remove(struct device *dev)
{
{
	struct wm8804_priv *wm8804;
	int i;

	wm8804 = dev_get_drvdata(dev);

	for (i = 0; i < ARRAY_SIZE(wm8804->supplies); ++i)
		regulator_unregister_notifier(wm8804->supplies[i].consumer,
					      &wm8804->disable_nb[i]);

	snd_soc_unregister_codec(dev);
	snd_soc_unregister_codec(dev);
}
}
EXPORT_SYMBOL_GPL(wm8804_remove);
EXPORT_SYMBOL_GPL(wm8804_remove);