Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: cs42l51: Fix some error handling paths in cs42l51_probe()

If devm_gpiod_get_optional() fails, we need to disable previously enabled
regulators, as done in the other error handling path of the function.

Also, gpiod_set_value_cansleep(, 1) needs to be called to undo a
potential gpiod_set_value_cansleep(, 0).
If the "reset" gpio is not defined, this additional call is just a no-op.

This behavior is the same as the one already in the .remove() function.

Fixes: 11b9cd748e31 ("ASoC: cs42l51: add reset management")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/a5e5f4b9fb03f46abd2c93ed94b5c395972ce0d1.1729975570.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Christophe JAILLET and committed by
Mark Brown
d221b844 6668610b

+5 -2
+5 -2
sound/soc/codecs/cs42l51.c
··· 747 747 748 748 cs42l51->reset_gpio = devm_gpiod_get_optional(dev, "reset", 749 749 GPIOD_OUT_LOW); 750 - if (IS_ERR(cs42l51->reset_gpio)) 751 - return PTR_ERR(cs42l51->reset_gpio); 750 + if (IS_ERR(cs42l51->reset_gpio)) { 751 + ret = PTR_ERR(cs42l51->reset_gpio); 752 + goto error; 753 + } 752 754 753 755 if (cs42l51->reset_gpio) { 754 756 dev_dbg(dev, "Release reset gpio\n"); ··· 782 780 return 0; 783 781 784 782 error: 783 + gpiod_set_value_cansleep(cs42l51->reset_gpio, 1); 785 784 regulator_bulk_disable(ARRAY_SIZE(cs42l51->supplies), 786 785 cs42l51->supplies); 787 786 return ret;