Skip to content

Commit

Permalink
ASoC: rt5677: Return error if devm_gpiod_get_optional return ERR_PTR
Browse files Browse the repository at this point in the history
If devm_gpiod_get_optional() return ERR_PTR, it means something wrong
so request gpio fails. We had better return error in such case.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Axel Lin authored and Mark Brown committed Jul 29, 2015
1 parent f285f16 commit f8163c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/soc/codecs/rt5677.c
Original file line number Diff line number Diff line change
Expand Up @@ -5133,14 +5133,14 @@ static int rt5677_i2c_probe(struct i2c_client *i2c,
if (IS_ERR(rt5677->pow_ldo2)) {
ret = PTR_ERR(rt5677->pow_ldo2);
dev_err(&i2c->dev, "Failed to request POW_LDO2: %d\n", ret);
rt5677->pow_ldo2 = 0;
return ret;
}
rt5677->reset_pin = devm_gpiod_get_optional(&i2c->dev,
"realtek,reset", GPIOD_OUT_HIGH);
if (IS_ERR(rt5677->reset_pin)) {
ret = PTR_ERR(rt5677->reset_pin);
dev_err(&i2c->dev, "Failed to request RESET: %d\n", ret);
rt5677->reset_pin = 0;
return ret;
}

if (rt5677->pow_ldo2 || rt5677->reset_pin) {
Expand Down

0 comments on commit f8163c8

Please sign in to comment.