OSDN Git Service
(root)
/
uclinux-h8
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eaf072e
)
ASoC: max98373: replace gpio_request with devm_gpio_request
author
Yong Zhi
<yong.zhi@intel.com>
Mon, 4 Nov 2019 22:09:59 +0000
(16:09 -0600)
committer
Mark Brown
<broonie@kernel.org>
Tue, 5 Nov 2019 18:52:41 +0000
(18:52 +0000)
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>
sound/soc/codecs/max98373.c
patch
|
blob
|
history
diff --git
a/sound/soc/codecs/max98373.c
b/sound/soc/codecs/max98373.c
index
eb709d5
..
cae1def
100644
(file)
--- 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);