Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: ASoC: rt286: add jack detection disable with NULL jack passed
@ 2015-02-26  8:14 Dan Carpenter
  2015-02-27  2:40 ` Jie, Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-02-26  8:14 UTC (permalink / raw)
  To: yang.jie; +Cc: alsa-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-27  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-26  8:14 ASoC: rt286: add jack detection disable with NULL jack passed Dan Carpenter
2015-02-27  2:40 ` Jie, Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox