driver acr122_usb: fix dead code issue
Redundant result check leading to dead code was probably indicative of a missing return value check of acr122_usb_send_apdu() Problem reported by Coverity: at_least: At condition "res < 0", the value of "res" must be at least 12. cannot_single: At condition "res < 0", the value of "res" cannot be equal to -6. dead_error_condition: The condition "res < 0" cannot be true. CID 1090327 (#1 of 1): Logically dead code (DEADCODE) dead_error_begin: Execution cannot reach this statement "acr122_usb_ack(pnd);".
This commit is contained in:
parent
117b58f501
commit
9bb568b799
1 changed files with 17 additions and 17 deletions
|
@ -616,6 +616,8 @@ read:
|
||||||
}
|
}
|
||||||
if (res < 12) {
|
if (res < 12) {
|
||||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Invalid RDR_to_PC_DataBlock frame");
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Invalid RDR_to_PC_DataBlock frame");
|
||||||
|
// try to interrupt current device state
|
||||||
|
acr122_usb_ack(pnd);
|
||||||
pnd->last_error = NFC_EIO;
|
pnd->last_error = NFC_EIO;
|
||||||
return pnd->last_error;
|
return pnd->last_error;
|
||||||
}
|
}
|
||||||
|
@ -644,27 +646,25 @@ read:
|
||||||
pnd->last_error = NFC_EIO;
|
pnd->last_error = NFC_EIO;
|
||||||
return pnd->last_error;
|
return pnd->last_error;
|
||||||
}
|
}
|
||||||
acr122_usb_send_apdu(pnd, APDU_GetAdditionnalData, 0x00, 0x00, NULL, 0, abtRxBuf[11], abtRxBuf, sizeof(abtRxBuf));
|
res = acr122_usb_send_apdu(pnd, APDU_GetAdditionnalData, 0x00, 0x00, NULL, 0, abtRxBuf[11], abtRxBuf, sizeof(abtRxBuf));
|
||||||
}
|
if (res == NFC_ETIMEOUT) {
|
||||||
offset = 0;
|
if (DRIVER_DATA(pnd)->abort_flag) {
|
||||||
if (res == NFC_ETIMEOUT) {
|
DRIVER_DATA(pnd)->abort_flag = false;
|
||||||
if (DRIVER_DATA(pnd)->abort_flag) {
|
acr122_usb_ack(pnd);
|
||||||
DRIVER_DATA(pnd)->abort_flag = false;
|
pnd->last_error = NFC_EOPABORTED;
|
||||||
|
return pnd->last_error;
|
||||||
|
} else {
|
||||||
|
goto read; // FIXME May cause some trouble on Touchatag, right ?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (res < 12) {
|
||||||
|
// try to interrupt current device state
|
||||||
acr122_usb_ack(pnd);
|
acr122_usb_ack(pnd);
|
||||||
pnd->last_error = NFC_EOPABORTED;
|
pnd->last_error = NFC_EIO;
|
||||||
return pnd->last_error;
|
return pnd->last_error;
|
||||||
} else {
|
|
||||||
goto read; // FIXME May cause some trouble on Touchatag, right ?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
offset = 0;
|
||||||
if (res < 0) {
|
|
||||||
// try to interrupt current device state
|
|
||||||
acr122_usb_ack(pnd);
|
|
||||||
pnd->last_error = res;
|
|
||||||
return pnd->last_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (abtRxBuf[offset] != attempted_response) {
|
if (abtRxBuf[offset] != attempted_response) {
|
||||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Frame header mismatch");
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "%s", "Frame header mismatch");
|
||||||
pnd->last_error = NFC_EIO;
|
pnd->last_error = NFC_EIO;
|
||||||
|
|
Loading…
Add table
Reference in a new issue