aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/cs4271.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/cs4271.c')
-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 f994af34f552..e3f0a7f3131e 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};