From afb3299a8770fc956557cfa1a44e45b642164d24 Mon Sep 17 00:00:00 2001 From: Alan Swanson Date: Fri, 16 Dec 2022 16:23:39 +0000 Subject: [PATCH 1/2] media: tbsecp3: Fix bitwise comparison always evaluates to false warnings From -Wtautological-compare in GCC. Masking a value and comparing to one will only work if the mask itself is equal to one (which is not the case here). Comparing to zero works for any mask. --- drivers/media/pci/tbsecp3/tbsecp3-dvb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/tbsecp3/tbsecp3-dvb.c b/drivers/media/pci/tbsecp3/tbsecp3-dvb.c index 0a90fab54359..6290b8a1edd2 100644 --- a/drivers/media/pci/tbsecp3/tbsecp3-dvb.c +++ b/drivers/media/pci/tbsecp3/tbsecp3-dvb.c @@ -173,7 +173,7 @@ static int tbs6302se_read_mac(struct tbsecp3_adapter *adap) //printk(" the receiver always busy !\n"); //check mcu status *(u32 *)tmpbuf = tbs_read( BASE_ADDRESS_24CXX, STATUS_MAC16_24CXX ); - if((tmpbuf[0]&0x4) == 1) // bit2==1 mcu busy + if((tmpbuf[0]&0x4) != 0) // bit2==1 mcu busy { //printk("MCU status is busy!!!\n" ); // release cs; @@ -241,7 +241,7 @@ static int tbs6304_read_mac(struct tbsecp3_adapter *adap) //printk(" the receiver always busy !\n"); //check mcu status *(u32 *)tmpbuf = tbs_read( BASE_ADDRESS_24CXX, STATUS_MAC16_24CXX ); - if((tmpbuf[0]&0x4) == 1) // bit2==1 mcu busy + if((tmpbuf[0]&0x4) != 0) // bit2==1 mcu busy { //printk("MCU status is busy!!!\n" ); // release cs; @@ -347,7 +347,7 @@ static int tbs6308_read_mac_ext(struct tbsecp3_adapter *adap) ret = 0; //check mcu status *(u32 *)tmpbuf = tbs_read_ext(adap, BASE_ADDRESS_24CXX, STATUS_MAC16_24CXX ); - if((tmpbuf[0]&0x4) == 1) // bit2==1 mcu busy + if((tmpbuf[0]&0x4) != 0) // bit2==1 mcu busy { //printk("MCU status is busy!!!\n" ); // release cs; @@ -410,7 +410,7 @@ static void tbs6301_read_mac(struct tbsecp3_adapter *adap) printk(" the receiver always busy !\n"); //check mcu status *(u32 *)tmpbuf = tbs_read( BASE_ADDRESS_24CXX, STATUS_MAC16_24CXX ); - if((tmpbuf[0]&0x4) == 1) // bit2==1 mcu busy + if((tmpbuf[0]&0x4) != 0) // bit2==1 mcu busy { printk("MCU status is busy!!!\n" ); // release cs; From 6d227e66827db50ce573c5e275478a3fda74c7a2 Mon Sep 17 00:00:00 2001 From: Alan Swanson Date: Fri, 16 Dec 2022 16:37:25 +0000 Subject: [PATCH 2/2] media: tbsecp3: Fix misleading indentation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From -Wmisleading-indentation in GCC. drivers/media/pci/tbsecp3/tbsecp3-dvb.c: In function ‘tbsecp3_frontend_attach’: drivers/media/pci/tbsecp3/tbsecp3-dvb.c:1487:17: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 1487 | if (adapter->fe == NULL) | ^~ drivers/media/pci/tbsecp3/tbsecp3-dvb.c:1489:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 1489 | if(adapter->nr <4) | ^~ --- drivers/media/pci/tbsecp3/tbsecp3-dvb.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/media/pci/tbsecp3/tbsecp3-dvb.c b/drivers/media/pci/tbsecp3/tbsecp3-dvb.c index 6290b8a1edd2..cb81a1e6feb0 100644 --- a/drivers/media/pci/tbsecp3/tbsecp3-dvb.c +++ b/drivers/media/pci/tbsecp3/tbsecp3-dvb.c @@ -1581,16 +1581,14 @@ static int tbsecp3_frontend_attach(struct tbsecp3_adapter *adapter) adapter->fe = dvb_attach(tas2971_attach, &tbs6308_demod_cfg, i2c); if (adapter->fe == NULL) goto frontend_atach_fail; - if(adapter->nr <4) - { - if(tbs6304_read_mac(adapter)==0) - tbs6304_read_mac(adapter); - } - else - { - if(tbs6308_read_mac_ext(adapter)==0) - tbs6308_read_mac_ext(adapter);//try again - } + + if(adapter->nr < 4) { + if(tbs6304_read_mac(adapter)==0) + tbs6304_read_mac(adapter); + } else { + if(tbs6308_read_mac_ext(adapter)==0) + tbs6308_read_mac_ext(adapter);//try again + } break; case TBSECP3_BOARD_TBS6304: