Commit 26c2c997 authored by Dmitry Osipenko's avatar Dmitry Osipenko Committed by Mark Brown

regulator: core: Release coupled_rdevs on regulator_init_coupling() error

This patch fixes memory leak which should happen if regulator's coupling
fails to initialize.

Fixes: d8ca7d18 ("regulator: core: Introduce API for regulators coupling customization")
Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20191025002240.25288-1-digetx@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 55d5f62c
......@@ -5198,6 +5198,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
regulator_remove_coupling(rdev);
mutex_unlock(&regulator_list_mutex);
wash:
kfree(rdev->coupling_desc.coupled_rdevs);
kfree(rdev->constraints);
mutex_lock(&regulator_list_mutex);
regulator_ena_gpio_free(rdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment