Message ID | 1416300619-14334-2-git-send-email-bardliao@realtek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Nov 18, 2014 at 04:50:19PM +0800, Bard Liao wrote: > @@ -2209,6 +2209,10 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec) > int gpio_state, jack_type = 0; > unsigned int val; > > + if (!gpio_is_valid(rt5645->pdata.hp_det_gpio)) { > + dev_err(codec->dev, "invalid gpio\n"); > + return 0; > + } It's not obvious that we should be returning 0 here - shouldn't we be returning an error? After all an error message is being displayed.
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index a7789a8..bbf2005c 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -2209,6 +2209,10 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec) int gpio_state, jack_type = 0; unsigned int val; + if (!gpio_is_valid(rt5645->pdata.hp_det_gpio)) { + dev_err(codec->dev, "invalid gpio\n"); + return 0; + } gpio_state = gpio_get_value(rt5645->pdata.hp_det_gpio); dev_dbg(codec->dev, "gpio = %d(%d)\n", rt5645->pdata.hp_det_gpio,