aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2012-11-10 13:52:50 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-11-13 01:45:35 -0500
commit5574f7745436d2014fcba1163f820d132e816c85 (patch)
tree00df49bbed003249faeb0665916c591965ac5a03 /sound
parent77b67063bb6bce6d475e910d3b886a606d0d91f7 (diff)
ASoC: cs4271: free allocated GPIO
In case of probe deferral, the allocated GPIO line is not freed, which prevents it from being claimed and properly asserted in later attempts. Fix this by using devm_gpio_request(). Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-by: Michael Hirsch <hirsch@teufel.de> Cc: Alexander Sverdlin <subaparts@yandex.ru> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/cs4271.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index f994af34f55..e3f0a7f3131 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -485,7 +485,7 @@ static int cs4271_probe(struct snd_soc_codec *codec)
485 gpio_nreset = cs4271plat->gpio_nreset; 485 gpio_nreset = cs4271plat->gpio_nreset;
486 486
487 if (gpio_nreset >= 0) 487 if (gpio_nreset >= 0)
488 if (gpio_request(gpio_nreset, "CS4271 Reset")) 488 if (devm_gpio_request(codec->dev, gpio_nreset, "CS4271 Reset"))
489 gpio_nreset = -EINVAL; 489 gpio_nreset = -EINVAL;
490 if (gpio_nreset >= 0) { 490 if (gpio_nreset >= 0) {
491 /* Reset codec */ 491 /* Reset codec */
@@ -535,15 +535,10 @@ static int cs4271_probe(struct snd_soc_codec *codec)
535static int cs4271_remove(struct snd_soc_codec *codec) 535static int cs4271_remove(struct snd_soc_codec *codec)
536{ 536{
537 struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); 537 struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
538 int gpio_nreset;
539 538
540 gpio_nreset = cs4271->gpio_nreset; 539 if (gpio_is_valid(cs4271->gpio_nreset))
541
542 if (gpio_is_valid(gpio_nreset)) {
543 /* Set codec to the reset state */ 540 /* Set codec to the reset state */
544 gpio_set_value(gpio_nreset, 0); 541 gpio_set_value(cs4271->gpio_nreset, 0);
545 gpio_free(gpio_nreset);
546 }
547 542
548 return 0; 543 return 0;
549}; 544};