summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorYong Zhi <yong.zhi@intel.com>2019-11-05 01:09:59 +0300
committerMark Brown <broonie@kernel.org>2019-11-05 21:52:41 +0300
commite44f3d49f900c645af434a3a1dfdbfb79c4a7851 (patch)
treebb7824d80570da5bf4c74dc92e99905376242b32 /sound
parenteaf072e512d54c95b0977eda06cbca3151ace1e5 (diff)
downloadlinux-e44f3d49f900c645af434a3a1dfdbfb79c4a7851.tar.xz
ASoC: max98373: replace gpio_request with devm_gpio_request
Use devm_gpio_request() to automatic unroll when fails and avoid resource leaks at error paths. Signed-off-by: Yong Zhi <yong.zhi@intel.com> Link: https://lore.kernel.org/r/1572905399-22402-1-git-send-email-yong.zhi@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/max98373.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/max98373.c b/sound/soc/codecs/max98373.c
index eb709d528259..cae1def8902d 100644
--- a/sound/soc/codecs/max98373.c
+++ b/sound/soc/codecs/max98373.c
@@ -960,11 +960,11 @@ static int max98373_i2c_probe(struct i2c_client *i2c,
/* Power on device */
if (gpio_is_valid(max98373->reset_gpio)) {
- ret = gpio_request(max98373->reset_gpio, "MAX98373_RESET");
+ ret = devm_gpio_request(&i2c->dev, max98373->reset_gpio,
+ "MAX98373_RESET");
if (ret) {
dev_err(&i2c->dev, "%s: Failed to request gpio %d\n",
__func__, max98373->reset_gpio);
- gpio_free(max98373->reset_gpio);
return -EINVAL;
}
gpio_direction_output(max98373->reset_gpio, 0);