ASoC: pcm3008: Replace w->codec snd_soc_dapm_to_codec(w->dapm)
[firefly-linux-kernel-4.4.55.git] / sound / soc / codecs / rt5645.c
index a7789a8726e34615b66eeefa639b7bd4718ac254..27141e2df878a65204fc31cc9486fb099319bd26 100644 (file)
@@ -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 -EINVAL;
+       }
        gpio_state = gpio_get_value(rt5645->pdata.hp_det_gpio);
 
        dev_dbg(codec->dev, "gpio = %d(%d)\n", rt5645->pdata.hp_det_gpio,