ASoC: cs35l33: Fix testing return value of devm_gpiod_get_optional

devm_gpiod_get_optional() returns NULL when the gpio is not assigned.
So the if (PTR_ERR(cs35l33->reset_gpio) == -ENOENT) test is always false.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Paul Handrigan <Paul.Handrigan@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Axel Lin 2016-06-30 08:13:34 +08:00 коммит произвёл Mark Brown
Родитель 20f12f2c48
Коммит 410fe39c6d
1 изменённых файлов: 1 добавлений и 5 удалений

Просмотреть файл

@ -1176,11 +1176,7 @@ static int cs35l33_i2c_probe(struct i2c_client *i2c_client,
/* We could issue !RST or skip it based on AMP topology */ /* We could issue !RST or skip it based on AMP topology */
cs35l33->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev, cs35l33->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev,
"reset-gpios", GPIOD_OUT_HIGH); "reset-gpios", GPIOD_OUT_HIGH);
if (IS_ERR(cs35l33->reset_gpio)) {
if (PTR_ERR(cs35l33->reset_gpio) == -ENOENT) {
dev_warn(&i2c_client->dev,
"%s WARNING: No reset gpio assigned\n", __func__);
} else if (IS_ERR(cs35l33->reset_gpio)) {
dev_err(&i2c_client->dev, "%s ERROR: Can't get reset GPIO\n", dev_err(&i2c_client->dev, "%s ERROR: Can't get reset GPIO\n",
__func__); __func__);
return PTR_ERR(cs35l33->reset_gpio); return PTR_ERR(cs35l33->reset_gpio);