Hello Jiawen Wu, The patch 1efa9bfe58c5: "net: libwx: Implement interaction with firmware" from Oct 31, 2022, leads to the following Smatch static checker warning: drivers/net/ethernet/wangxun/libwx/wx_hw.c:210 wx_host_interface_command() warn: duplicate check 'status' (previous on line 206) drivers/net/ethernet/wangxun/libwx/wx_hw.c 200 /* Setting this bit tells the ARC that a new command is pending. */ 201 wr32m(wxhw, WX_MNG_MBOX_CTL, 202 WX_MNG_MBOX_CTL_SWRDY, WX_MNG_MBOX_CTL_SWRDY); 203 204 status = read_poll_timeout(rd32, hicr, hicr & WX_MNG_MBOX_CTL_FWRDY, 1000, 205 timeout * 1000, false, wxhw, WX_MNG_MBOX_CTL); 206 if (status) ^^^^^^ Checked 207 goto rel_out; 208 209 /* Check command completion */ --> 210 if (status) { ^^^^^^ Dead code. 211 wx_dbg(wxhw, "Command has failed with no status valid.\n"); 212 213 buf[0] = rd32(wxhw, WX_MNG_MBOX); 214 if ((buffer[0] & 0xff) != (~buf[0] >> 24)) { 215 status = -EINVAL; 216 goto rel_out; 217 } 218 if ((buf[0] & 0xff0000) >> 16 == 0x80) { 219 wx_dbg(wxhw, "It's unknown cmd.\n"); 220 status = -EINVAL; 221 goto rel_out; 222 } 223 224 wx_dbg(wxhw, "write value:\n"); 225 for (i = 0; i < dword_len; i++) 226 wx_dbg(wxhw, "%x ", buffer[i]); 227 wx_dbg(wxhw, "read value:\n"); 228 for (i = 0; i < dword_len; i++) 229 wx_dbg(wxhw, "%x ", buf[i]); 230 } 231 232 if (!return_data) 233 goto rel_out; 234 235 /* Calculate length in DWORDs */ 236 dword_len = hdr_size >> 2; 237 238 /* first pull in the header so we know the buffer length */ 239 for (bi = 0; bi < dword_len; bi++) { 240 buffer[bi] = rd32a(wxhw, WX_MNG_MBOX, bi); 241 le32_to_cpus(&buffer[bi]); 242 } 243 244 /* If there is any thing in data position pull it in */ 245 buf_len = ((struct wx_hic_hdr *)buffer)->buf_len; 246 if (buf_len == 0) 247 goto rel_out; 248 249 if (length < buf_len + hdr_size) { 250 wx_err(wxhw, "Buffer not large enough for reply message.\n"); 251 status = -EFAULT; 252 goto rel_out; 253 } 254 255 /* Calculate length in DWORDs, add 3 for odd lengths */ 256 dword_len = (buf_len + 3) >> 2; 257 258 /* Pull in the rest of the buffer (bi is where we left off) */ 259 for (; bi <= dword_len; bi++) { 260 buffer[bi] = rd32a(wxhw, WX_MNG_MBOX, bi); 261 le32_to_cpus(&buffer[bi]); 262 } 263 264 rel_out: 265 wx_release_sw_sync(wxhw, WX_MNG_SWFW_SYNC_SW_MB); 266 return status; 267 } regards, dan carpenter