linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] [media] af9013: change & to &&
@ 2012-01-05  6:23 Dan Carpenter
  2012-01-09 17:40 ` Antti Palosaari
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-01-05  6:23 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Antti Palosaari, linux-media, kernel-janitors

This is just a cleanup, it doesn't change how the code works.  These
are compound conditions and not bitwise operations so it should be &&
and not &.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/media/dvb/frontends/af9013.c b/drivers/media/dvb/frontends/af9013.c
index e6ba3e0..1413c51 100644
--- a/drivers/media/dvb/frontends/af9013.c
+++ b/drivers/media/dvb/frontends/af9013.c
@@ -120,8 +120,8 @@ static int af9013_wr_regs(struct af9013_state *priv, u16 reg, const u8 *val,
 	int ret, i;
 	u8 mbox = (0 << 7)|(0 << 6)|(1 << 1)|(1 << 0);
 
-	if ((priv->config.ts_mode == AF9013_TS_USB) &
-		((reg & 0xff00) != 0xff00) & ((reg & 0xff00) != 0xae00)) {
+	if ((priv->config.ts_mode == AF9013_TS_USB) &&
+		((reg & 0xff00) != 0xff00) && ((reg & 0xff00) != 0xae00)) {
 		mbox |= ((len - 1) << 2);
 		ret = af9013_wr_regs_i2c(priv, mbox, reg, val, len);
 	} else {
@@ -142,8 +142,8 @@ static int af9013_rd_regs(struct af9013_state *priv, u16 reg, u8 *val, int len)
 	int ret, i;
 	u8 mbox = (0 << 7)|(0 << 6)|(1 << 1)|(0 << 0);
 
-	if ((priv->config.ts_mode == AF9013_TS_USB) &
-		((reg & 0xff00) != 0xff00) & ((reg & 0xff00) != 0xae00)) {
+	if ((priv->config.ts_mode == AF9013_TS_USB) &&
+		((reg & 0xff00) != 0xff00) && ((reg & 0xff00) != 0xae00)) {
 		mbox |= ((len - 1) << 2);
 		ret = af9013_rd_regs_i2c(priv, mbox, reg, val, len);
 	} else {

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

* Re: [patch] [media] af9013: change & to &&
  2012-01-05  6:23 [patch] [media] af9013: change & to && Dan Carpenter
@ 2012-01-09 17:40 ` Antti Palosaari
  2012-01-09 17:48   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Antti Palosaari @ 2012-01-09 17:40 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors

Clear bug, I will test it later when applied to master if not already. 
Thanks!

Acked-by: Antti Palosaari <crope@iki.fi>


On 01/05/2012 08:23 AM, Dan Carpenter wrote:
> This is just a cleanup, it doesn't change how the code works.  These
> are compound conditions and not bitwise operations so it should be&&
> and not&.
>
> Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>
>
> diff --git a/drivers/media/dvb/frontends/af9013.c b/drivers/media/dvb/frontends/af9013.c
> index e6ba3e0..1413c51 100644
> --- a/drivers/media/dvb/frontends/af9013.c
> +++ b/drivers/media/dvb/frontends/af9013.c
> @@ -120,8 +120,8 @@ static int af9013_wr_regs(struct af9013_state *priv, u16 reg, const u8 *val,
>   	int ret, i;
>   	u8 mbox = (0<<  7)|(0<<  6)|(1<<  1)|(1<<  0);
>
> -	if ((priv->config.ts_mode == AF9013_TS_USB)&
> -		((reg&  0xff00) != 0xff00)&  ((reg&  0xff00) != 0xae00)) {
> +	if ((priv->config.ts_mode == AF9013_TS_USB)&&
> +		((reg&  0xff00) != 0xff00)&&  ((reg&  0xff00) != 0xae00)) {
>   		mbox |= ((len - 1)<<  2);
>   		ret = af9013_wr_regs_i2c(priv, mbox, reg, val, len);
>   	} else {
> @@ -142,8 +142,8 @@ static int af9013_rd_regs(struct af9013_state *priv, u16 reg, u8 *val, int len)
>   	int ret, i;
>   	u8 mbox = (0<<  7)|(0<<  6)|(1<<  1)|(0<<  0);
>
> -	if ((priv->config.ts_mode == AF9013_TS_USB)&
> -		((reg&  0xff00) != 0xff00)&  ((reg&  0xff00) != 0xae00)) {
> +	if ((priv->config.ts_mode == AF9013_TS_USB)&&
> +		((reg&  0xff00) != 0xff00)&&  ((reg&  0xff00) != 0xae00)) {
>   		mbox |= ((len - 1)<<  2);
>   		ret = af9013_rd_regs_i2c(priv, mbox, reg, val, len);
>   	} else {


-- 
http://palosaari.fi/

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

* Re: [patch] [media] af9013: change & to &&
  2012-01-09 17:40 ` Antti Palosaari
@ 2012-01-09 17:48   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-01-09 17:48 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]

On Mon, Jan 09, 2012 at 07:40:49PM +0200, Antti Palosaari wrote:
> Clear bug, I will test it later when applied to master if not
> already. Thanks!

You're welcome, but it's not a bug because (1 & 1 & 0) is the same
as (1 && 1 && 0) but if one of them wasn't a bool it would be a
problem.  The other difference between & and && is that && has
orderring guarantees but that's also not a factor here.

regards,
dan carpenter


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-01-09 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-05  6:23 [patch] [media] af9013: change & to && Dan Carpenter
2012-01-09 17:40 ` Antti Palosaari
2012-01-09 17:48   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).