12 Jul
2015
12 Jul
'15
12:31 p.m.
On 07/12/2015 08:56 AM, Anatol Pomozov wrote: [...]
@@ -61,7 +64,7 @@ static int max98357a_codec_probe(struct snd_soc_codec *codec) struct gpio_desc *sdmode;
sdmode = devm_gpiod_get(codec->dev, "sdmode", GPIOD_OUT_LOW);
- if (IS_ERR(sdmode)) {
- if (IS_ERR(sdmode) && (PTR_ERR(sdmode) != -ENOENT)) {
There is is devm_gpiod_get_optional() exactly for this use case. It will return NULL if no GPIO is specified.
dev_err(codec->dev, "%s() unable to get sdmode GPIO: %ld\n", __func__, PTR_ERR(sdmode)); return PTR_ERR(sdmode);