public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ralph Metzler <rjkm@metzlerbros.de>
Cc: linux-media@vger.kernel.org
Subject: Re: [media] DRX-K: Initial check-in
Date: Sun, 10 Jun 2012 23:54:51 +0300	[thread overview]
Message-ID: <20120610205451.GF13539@mwanda> (raw)
In-Reply-To: <20436.63646.824176.351205@morden.metzler>

On Sun, Jun 10, 2012 at 09:42:22PM +0200, Ralph Metzler wrote:
> Dan Carpenter writes:
>  > Hello Ralph Metzler,
>  > 
>  > The patch 43dd07f758d8: "[media] DRX-K: Initial check-in" from Jul 3, 
>  > 2011, leads to the following warning:
>  > drivers/media/dvb/frontends/drxk_hard.c:2980 ADCSynchronization()
>  > 	 warn: suspicious bitop condition
>  > 
>  >   2977                  status = read16(state, IQM_AF_CLKNEG__A, &clkNeg);
>  >   2978                  if (status < 0)
>  >   2979                          goto error;
>  >   2980                  if ((clkNeg | IQM_AF_CLKNEG_CLKNEGDATA__M) ==
>  >   2981                          IQM_AF_CLKNEG_CLKNEGDATA_CLK_ADC_DATA_POS) {
>  > 
>  > IQM_AF_CLKNEG_CLKNEGDATA__M is 2.
>  > IQM_AF_CLKNEG_CLKNEGDATA_CLK_ADC_DATA_POS is 0.
>  > So this condition can never be true.
> 
> It seems this should be & instead of |. The mistake was also present in the windows driver.
> 

Good deal.  Do you want me to send a patch, or are you going to
handle it?  Could I get a Reported-by cookie?

> 
>  > 
>  >   2982                          clkNeg &= (~(IQM_AF_CLKNEG_CLKNEGDATA__M));
>  >   2983                          clkNeg |=
>  >   2984                                  IQM_AF_CLKNEG_CLKNEGDATA_CLK_ADC_DATA_NEG;
>  >   2985                  } else {
>  >   2986                          clkNeg &= (~(IQM_AF_CLKNEG_CLKNEGDATA__M));
>  >   2987                          clkNeg |=
>  >   2988                                  IQM_AF_CLKNEG_CLKNEGDATA_CLK_ADC_DATA_POS;
>  > 
>  > 	clkNeg |= 0; <-- doesn't make much sense to the unenlightened.
>  > 
>  >   2989                  }
> 
> This is perfectly normal since those defines were automatically created from the 
> firmware source code. It is better to leave the code as it is. If there ever is a firmware update 
> and these bits change their values it will be much harder to adjust the driver.
> 

Sounds good.  When I ran my script against the kernel it turns out
that doing x |= FOO; where foo is zero is very normal.

regards,
dan carpenter


  reply	other threads:[~2012-06-10 20:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08 13:46 [media] DRX-K: Initial check-in Dan Carpenter
2012-06-10 19:42 ` Ralph Metzler
2012-06-10 20:54   ` Dan Carpenter [this message]
2012-06-15 16:54     ` Ralph Metzler
2012-06-26  8:40       ` [patch] [media] drxk: fix a '&' vs '|' bug Dan Carpenter

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=20120610205451.GF13539@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-media@vger.kernel.org \
    --cc=rjkm@metzlerbros.de \
    /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