ASoC: rt5645: fix error handling for gpio detection
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Wed, 1 Feb 2017 18:27:04 +0000 (12:27 -0600)
committerMark Brown <broonie@kernel.org>
Wed, 1 Feb 2017 18:35:06 +0000 (18:35 +0000)
Optional gpio handling should not cause an error status and prevent
probing if it's missing.  Remove error return for -ENOENT case and
move error message to dev_info

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5645.c

index 37fb2b6c34a5f9fcb69a1dafbadf6b71a12075bd..e09fa19f44c0cb4a1f407d3ad84212ff830f9b39 100644 (file)
@@ -3658,8 +3658,14 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
                                                       GPIOD_IN);
 
        if (IS_ERR(rt5645->gpiod_hp_det)) {
-               dev_err(&i2c->dev, "failed to initialize gpiod\n");
-               return PTR_ERR(rt5645->gpiod_hp_det);
+               dev_info(&i2c->dev, "failed to initialize gpiod\n");
+               ret = PTR_ERR(rt5645->gpiod_hp_det);
+               /*
+                * Continue if optional gpiod is missing, bail for all other
+                * errors, including -EPROBE_DEFER
+                */
+               if (ret != -ENOENT)
+                       return ret;
        }
 
        for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++)