CC: [email protected] CC: [email protected] TO: Tali Perry <[email protected]> CC: Wolfram Sang <[email protected]> CC: Andy Shevchenko <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 856deb866d16e29bd65952e0289066f6078af773 commit: 56a1485b102ed1cd5a4af8e87ed794699fd1cad2 i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver date: 3 months ago :::::: branch date: 4 hours ago :::::: commit date: 3 months ago compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> cppcheck warnings: (new ones prefixed by >>) >> drivers/i2c/busses/i2c-npcm7xx.c:1151:10: warning: Variable 'status' is >> reassigned a value before the old one has been used. [redundantAssignment] status = 0; ^ drivers/i2c/busses/i2c-npcm7xx.c:1088:0: note: Variable 'status' is reassigned a value before the old one has been used. int status = -ENOTRECOVERABLE; ^ drivers/i2c/busses/i2c-npcm7xx.c:1151:10: note: Variable 'status' is reassigned a value before the old one has been used. status = 0; ^ >> drivers/i2c/busses/i2c-npcm7xx.c:1151:10: warning: Variable 'status' is >> reassigned a value before the old one has been used. [redundantAssignment] status = 0; ^ drivers/i2c/busses/i2c-npcm7xx.c:1138:10: note: Variable 'status' is reassigned a value before the old one has been used. status = readx_poll_timeout(npcm_i2c_get_SCL, _adap, val, !val, ^ drivers/i2c/busses/i2c-npcm7xx.c:1151:10: note: Variable 'status' is reassigned a value before the old one has been used. status = 0; ^ # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=56a1485b102ed1cd5a4af8e87ed794699fd1cad2 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 56a1485b102ed1cd5a4af8e87ed794699fd1cad2 vim +/status +1151 drivers/i2c/busses/i2c-npcm7xx.c 56a1485b102ed1c Tali Perry 2020-05-27 1081 56a1485b102ed1c Tali Perry 2020-05-27 1082 /* recovery using TGCLK functionality of the module */ 56a1485b102ed1c Tali Perry 2020-05-27 1083 static int npcm_i2c_recovery_tgclk(struct i2c_adapter *_adap) 56a1485b102ed1c Tali Perry 2020-05-27 1084 { 56a1485b102ed1c Tali Perry 2020-05-27 1085 u8 val; 56a1485b102ed1c Tali Perry 2020-05-27 1086 u8 fif_cts; 56a1485b102ed1c Tali Perry 2020-05-27 1087 bool done = false; 56a1485b102ed1c Tali Perry 2020-05-27 1088 int status = -ENOTRECOVERABLE; 56a1485b102ed1c Tali Perry 2020-05-27 1089 struct npcm_i2c *bus = container_of(_adap, struct npcm_i2c, adap); 56a1485b102ed1c Tali Perry 2020-05-27 1090 /* Allow 3 bytes (27 toggles) to be read from the slave: */ 56a1485b102ed1c Tali Perry 2020-05-27 1091 int iter = 27; 56a1485b102ed1c Tali Perry 2020-05-27 1092 56a1485b102ed1c Tali Perry 2020-05-27 1093 if ((npcm_i2c_get_SDA(_adap) == 1) && (npcm_i2c_get_SCL(_adap) == 1)) { 56a1485b102ed1c Tali Perry 2020-05-27 1094 dev_dbg(bus->dev, "bus%d recovery skipped, bus not stuck", 56a1485b102ed1c Tali Perry 2020-05-27 1095 bus->num); 56a1485b102ed1c Tali Perry 2020-05-27 1096 npcm_i2c_reset(bus); 56a1485b102ed1c Tali Perry 2020-05-27 1097 return status; 56a1485b102ed1c Tali Perry 2020-05-27 1098 } 56a1485b102ed1c Tali Perry 2020-05-27 1099 56a1485b102ed1c Tali Perry 2020-05-27 1100 npcm_i2c_int_enable(bus, false); 56a1485b102ed1c Tali Perry 2020-05-27 1101 npcm_i2c_disable(bus); 56a1485b102ed1c Tali Perry 2020-05-27 1102 npcm_i2c_enable(bus); 56a1485b102ed1c Tali Perry 2020-05-27 1103 iowrite8(NPCM_I2CCST_BB, bus->reg + NPCM_I2CCST); 56a1485b102ed1c Tali Perry 2020-05-27 1104 npcm_i2c_clear_tx_fifo(bus); 56a1485b102ed1c Tali Perry 2020-05-27 1105 npcm_i2c_clear_rx_fifo(bus); 56a1485b102ed1c Tali Perry 2020-05-27 1106 iowrite8(0, bus->reg + NPCM_I2CRXF_CTL); 56a1485b102ed1c Tali Perry 2020-05-27 1107 iowrite8(0, bus->reg + NPCM_I2CTXF_CTL); 56a1485b102ed1c Tali Perry 2020-05-27 1108 npcm_i2c_stall_after_start(bus, false); 56a1485b102ed1c Tali Perry 2020-05-27 1109 56a1485b102ed1c Tali Perry 2020-05-27 1110 /* select bank 1 for FIFO regs */ 56a1485b102ed1c Tali Perry 2020-05-27 1111 npcm_i2c_select_bank(bus, I2C_BANK_1); 56a1485b102ed1c Tali Perry 2020-05-27 1112 56a1485b102ed1c Tali Perry 2020-05-27 1113 /* clear FIFO and relevant status bits. */ 56a1485b102ed1c Tali Perry 2020-05-27 1114 fif_cts = ioread8(bus->reg + NPCM_I2CFIF_CTS); 56a1485b102ed1c Tali Perry 2020-05-27 1115 fif_cts &= ~NPCM_I2CFIF_CTS_SLVRSTR; 56a1485b102ed1c Tali Perry 2020-05-27 1116 fif_cts |= NPCM_I2CFIF_CTS_CLR_FIFO; 56a1485b102ed1c Tali Perry 2020-05-27 1117 iowrite8(fif_cts, bus->reg + NPCM_I2CFIF_CTS); 56a1485b102ed1c Tali Perry 2020-05-27 1118 npcm_i2c_set_fifo(bus, -1, 0); 56a1485b102ed1c Tali Perry 2020-05-27 1119 56a1485b102ed1c Tali Perry 2020-05-27 1120 /* Repeat the following sequence until SDA is released */ 56a1485b102ed1c Tali Perry 2020-05-27 1121 do { 56a1485b102ed1c Tali Perry 2020-05-27 1122 /* Issue a single SCL toggle */ 56a1485b102ed1c Tali Perry 2020-05-27 1123 iowrite8(NPCM_I2CCST_TGSCL, bus->reg + NPCM_I2CCST); 56a1485b102ed1c Tali Perry 2020-05-27 1124 usleep_range(20, 30); 56a1485b102ed1c Tali Perry 2020-05-27 1125 /* If SDA line is inactive (high), stop */ 56a1485b102ed1c Tali Perry 2020-05-27 1126 if (npcm_i2c_get_SDA(_adap)) { 56a1485b102ed1c Tali Perry 2020-05-27 1127 done = true; 56a1485b102ed1c Tali Perry 2020-05-27 1128 status = 0; 56a1485b102ed1c Tali Perry 2020-05-27 1129 } 56a1485b102ed1c Tali Perry 2020-05-27 1130 } while (!done && iter--); 56a1485b102ed1c Tali Perry 2020-05-27 1131 56a1485b102ed1c Tali Perry 2020-05-27 1132 /* If SDA line is released: send start-addr-stop, to re-sync. */ 56a1485b102ed1c Tali Perry 2020-05-27 1133 if (npcm_i2c_get_SDA(_adap)) { 56a1485b102ed1c Tali Perry 2020-05-27 1134 /* Send an address byte in write direction: */ 56a1485b102ed1c Tali Perry 2020-05-27 1135 npcm_i2c_wr_byte(bus, bus->dest_addr); 56a1485b102ed1c Tali Perry 2020-05-27 1136 npcm_i2c_master_start(bus); 56a1485b102ed1c Tali Perry 2020-05-27 1137 /* Wait until START condition is sent */ 56a1485b102ed1c Tali Perry 2020-05-27 1138 status = readx_poll_timeout(npcm_i2c_get_SCL, _adap, val, !val, 56a1485b102ed1c Tali Perry 2020-05-27 1139 20, 200); 56a1485b102ed1c Tali Perry 2020-05-27 1140 /* If START condition was sent */ 56a1485b102ed1c Tali Perry 2020-05-27 1141 if (npcm_i2c_is_master(bus) > 0) { 56a1485b102ed1c Tali Perry 2020-05-27 1142 usleep_range(20, 30); 56a1485b102ed1c Tali Perry 2020-05-27 1143 npcm_i2c_master_stop(bus); 56a1485b102ed1c Tali Perry 2020-05-27 1144 usleep_range(200, 500); 56a1485b102ed1c Tali Perry 2020-05-27 1145 } 56a1485b102ed1c Tali Perry 2020-05-27 1146 } 56a1485b102ed1c Tali Perry 2020-05-27 1147 npcm_i2c_reset(bus); 56a1485b102ed1c Tali Perry 2020-05-27 1148 npcm_i2c_int_enable(bus, true); 56a1485b102ed1c Tali Perry 2020-05-27 1149 56a1485b102ed1c Tali Perry 2020-05-27 1150 if ((npcm_i2c_get_SDA(_adap) == 1) && (npcm_i2c_get_SCL(_adap) == 1)) 56a1485b102ed1c Tali Perry 2020-05-27 @1151 status = 0; 56a1485b102ed1c Tali Perry 2020-05-27 1152 else 56a1485b102ed1c Tali Perry 2020-05-27 1153 status = -ENOTRECOVERABLE; 56a1485b102ed1c Tali Perry 2020-05-27 1154 if (status) { 56a1485b102ed1c Tali Perry 2020-05-27 1155 if (bus->rec_fail_cnt < ULLONG_MAX) 56a1485b102ed1c Tali Perry 2020-05-27 1156 bus->rec_fail_cnt++; 56a1485b102ed1c Tali Perry 2020-05-27 1157 } else { 56a1485b102ed1c Tali Perry 2020-05-27 1158 if (bus->rec_succ_cnt < ULLONG_MAX) 56a1485b102ed1c Tali Perry 2020-05-27 1159 bus->rec_succ_cnt++; 56a1485b102ed1c Tali Perry 2020-05-27 1160 } 56a1485b102ed1c Tali Perry 2020-05-27 1161 return status; 56a1485b102ed1c Tali Perry 2020-05-27 1162 } 56a1485b102ed1c Tali Perry 2020-05-27 1163 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
