af9013: change & to &&
Subsystems (2)
PATCH 1/1 af9013: change & to &&
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 &.
drivers/media/dvb/frontends/af9013.c +4 -4
@@ -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 {
Clear bug, I will test it later when applied to master if not already. Thanks!
Quoted 32 lines · Dan Carpenter
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<[email protected]>drivers/media/dvb/frontends/af9013.c +4
-4@@ -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 {
Signature · 1 line
http://palosaari.fi/
Quoted 2 lines · Antti Palosaari
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