summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2015-06-12 17:19:15 +0800
committerMark Brown <broonie@kernel.org>2015-06-12 11:52:29 +0100
commit25c8888ad65f812c847ae58398a5f8f1b20b0a95 (patch)
tree3f32f4710b51dc43fae8747b8573f85f60123a1f /sound
parent48edaa4b4fb6e75b890942394f0d0c2571d5c90d (diff)
downloadlinux-stable-25c8888ad65f812c847ae58398a5f8f1b20b0a95.tar.gz
linux-stable-25c8888ad65f812c847ae58398a5f8f1b20b0a95.tar.bz2
linux-stable-25c8888ad65f812c847ae58398a5f8f1b20b0a95.zip
ASoC: rt5645: Use devm_gpiod_get_optional for hp-detect
Since hp-detect is optional, use devm_gpiod_get_optional instead. In additional, it should return error if devm_gpiod_get_optional fails. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/rt5645.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 18842642a34e..43440436fd7b 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3268,11 +3268,12 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
else
rt5645_parse_dt(rt5645, &i2c->dev);
- rt5645->gpiod_hp_det = devm_gpiod_get(&i2c->dev, "hp-detect", GPIOD_IN);
+ rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect",
+ GPIOD_IN);
if (IS_ERR(rt5645->gpiod_hp_det)) {
- rt5645->gpiod_hp_det = NULL;
dev_err(&i2c->dev, "failed to initialize gpiod\n");
+ return PTR_ERR(rt5645->gpiod_hp_det);
}
rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5645_regmap);