Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: yang.jie@intel.com
Cc: alsa-devel@alsa-project.org
Subject: Re: ASoC: rt286: add jack detection disable with NULL jack passed
Date: Thu, 26 Feb 2015 11:14:54 +0300	[thread overview]
Message-ID: <20150226081454.GA28947@mwanda> (raw)

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

             reply	other threads:[~2015-02-26  8:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26  8:14 Dan Carpenter [this message]
2015-02-27  2:40 ` ASoC: rt286: add jack detection disable with NULL jack passed Jie, Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150226081454.GA28947@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=yang.jie@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox