[alsa-devel] ASoC: rt286: add jack detection disable with NULL jack passed

Dan Carpenter dan.carpenter at oracle.com
Thu Feb 26 09:14:54 CET 2015


Hello Jie Yang,

The patch e2cef68d5903: "ASoC: rt286: add jack detection disable with
NULL jack passed" from Feb 10, 2015, leads to the following static
checker warning:

	sound/soc/codecs/rt286.c:400 rt286_mic_detect()
	warn: suspicious bitop condition

sound/soc/codecs/rt286.c
   392  int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
   393  {
   394          struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec);
   395  
   396          rt286->jack = jack;
   397  
   398          if (jack) {
   399                  /* enable IRQ */
   400                  if (rt286->jack->status | SND_JACK_HEADPHONE)
                                                ^^^^^^^^^^^^^^^^^^^^
You probably intended bitwise AND here?  Bitwise OR is always true.

   401                          snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO1");
   402                  regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x2);
   403                  /* Send an initial empty report */
   404                  snd_soc_jack_report(rt286->jack, rt286->jack->status,
   405                          SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
   406          } else {
   407                  /* disable IRQ */
   408                  regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x0);
   409                  snd_soc_dapm_disable_pin(&codec->dapm, "LDO1");
   410          }
   411          snd_soc_dapm_sync(&codec->dapm);
   412  
   413          return 0;
   414  }

regards,
dan carpenter


More information about the Alsa-devel mailing list