Skip to content

Commit

Permalink
remove redundant retry count check found by coverity
Browse files Browse the repository at this point in the history
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
  • Loading branch information
jyao1 committed Aug 20, 2024
1 parent 9cf6658 commit 704d565
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions library/spdm_requester_lib/libspdm_req_challenge.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ libspdm_return_t libspdm_challenge(void *spdm_context, void *reserved,
measurement_hash_type,
measurement_hash, slot_mask,
NULL, NULL, NULL, NULL, NULL);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down Expand Up @@ -459,7 +459,7 @@ libspdm_return_t libspdm_challenge_ex(void *spdm_context, void *reserved,
requester_nonce, responder_nonce,
opaque_data,
opaque_data_size);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down Expand Up @@ -499,7 +499,7 @@ libspdm_return_t libspdm_challenge_ex2(void *spdm_context, void *reserved,
requester_nonce, responder_nonce,
opaque_data,
opaque_data_size);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_end_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ libspdm_return_t libspdm_send_receive_end_session(libspdm_context_t *spdm_contex
do {
status = libspdm_try_send_receive_end_session(
spdm_context, session_id, end_session_attributes);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_finish.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ libspdm_return_t libspdm_send_receive_finish(libspdm_context_t *spdm_context,
do {
status = libspdm_try_send_receive_finish(spdm_context, session_id,
req_slot_id_param);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_get_capabilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ libspdm_return_t libspdm_get_capabilities(libspdm_context_t *spdm_context)
retry_delay_time = spdm_context->retry_delay_time;
do {
status = libspdm_try_get_capabilities(spdm_context);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
4 changes: 2 additions & 2 deletions library/spdm_requester_lib/libspdm_req_get_certificate.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ libspdm_return_t libspdm_get_certificate_choose_length(void *spdm_context,
do {
status = libspdm_try_get_certificate(context, session_id, slot_id, length,
cert_chain_size, cert_chain, NULL, NULL);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down Expand Up @@ -490,7 +490,7 @@ libspdm_return_t libspdm_get_certificate_choose_length_ex(void *spdm_context,
status = libspdm_try_get_certificate(context, session_id, slot_id, length,
cert_chain_size, cert_chain, trust_anchor,
trust_anchor_size);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
4 changes: 2 additions & 2 deletions library/spdm_requester_lib/libspdm_req_get_csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ libspdm_return_t libspdm_get_csr(void * spdm_context,
opaque_data, opaque_data_length,
csr, csr_len,
0, 0, NULL);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down Expand Up @@ -296,7 +296,7 @@ libspdm_return_t libspdm_get_csr_ex(void * spdm_context,
csr, csr_len,
request_attribute, key_pair_id,
available_csr_tracking_tag);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_get_digests.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ libspdm_return_t libspdm_get_digest(void *spdm_context, const uint32_t *session_
retry_delay_time = context->retry_delay_time;
do {
status = libspdm_try_get_digest(context, session_id, slot_mask, total_digest_buffer);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_get_event_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ libspdm_return_t libspdm_get_event_types(void *spdm_context,
event_group_count,
supported_event_groups_list_len,
supported_event_groups_list);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ libspdm_return_t libspdm_get_measurement_extension_log_choose_length(void *spdm_
status = libspdm_try_get_measurement_extension_log(context, session_id,
length,
mel_size, measure_exten_log);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
6 changes: 3 additions & 3 deletions library/spdm_requester_lib/libspdm_req_get_measurements.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ libspdm_return_t libspdm_get_measurement(void *spdm_context, const uint32_t *ses
measurement_operation, slot_id_param, NULL, content_changed, number_of_blocks,
measurement_record_length, measurement_record,
NULL, NULL, NULL, NULL, NULL);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down Expand Up @@ -781,7 +781,7 @@ libspdm_return_t libspdm_get_measurement_ex(void *spdm_context, const uint32_t *
requester_nonce_in,
requester_nonce, responder_nonce,
opaque_data, opaque_data_size);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down Expand Up @@ -824,7 +824,7 @@ libspdm_return_t libspdm_get_measurement_ex2(void *spdm_context, const uint32_t
requester_nonce_in,
requester_nonce, responder_nonce,
opaque_data, opaque_data_size);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_get_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ libspdm_return_t libspdm_get_version(libspdm_context_t *spdm_context,
do {
status = libspdm_try_get_version(spdm_context,
version_number_entry_count, version_number_entry);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ libspdm_return_t libspdm_heartbeat(void *spdm_context, uint32_t session_id)
retry_delay_time = context->retry_delay_time;
do {
status = libspdm_try_heartbeat(context, session_id);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
4 changes: 2 additions & 2 deletions library/spdm_requester_lib/libspdm_req_key_exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ libspdm_return_t libspdm_send_receive_key_exchange(
session_id, heartbeat_period, req_slot_id_param,
measurement_hash,
NULL, NULL, NULL, NULL, 0, NULL, NULL);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down Expand Up @@ -872,7 +872,7 @@ libspdm_return_t libspdm_send_receive_key_exchange_ex(
requester_random, responder_random,
requester_opaque_data, requester_opaque_data_size,
responder_opaque_data, responder_opaque_data_size);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_key_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ libspdm_return_t libspdm_key_update(void *spdm_context, uint32_t session_id,
do {
status = libspdm_try_key_update(spdm_context, session_id,
single_direction, &key_updated);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ libspdm_return_t libspdm_negotiate_algorithms(libspdm_context_t *spdm_context)
retry_delay_time = spdm_context->retry_delay_time;
do {
status = libspdm_try_negotiate_algorithms(spdm_context);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
4 changes: 2 additions & 2 deletions library/spdm_requester_lib/libspdm_req_psk_exchange.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ libspdm_return_t libspdm_send_receive_psk_exchange(libspdm_context_t *spdm_conte
measurement_hash_type, session_policy, session_id,
heartbeat_period, measurement_hash,
NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down Expand Up @@ -636,7 +636,7 @@ libspdm_return_t libspdm_send_receive_psk_exchange_ex(libspdm_context_t *spdm_co
responder_context, responder_context_size,
requester_opaque_data, requester_opaque_data_size,
responder_opaque_data, responder_opaque_data_size);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_psk_finish.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ libspdm_return_t libspdm_send_receive_psk_finish(libspdm_context_t *spdm_context
do {
status = libspdm_try_send_receive_psk_finish(spdm_context,
session_id);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
4 changes: 2 additions & 2 deletions library/spdm_requester_lib/libspdm_req_set_certificate.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ libspdm_return_t libspdm_set_certificate(void *spdm_context,
do {
status = libspdm_try_set_certificate(context, session_id, slot_id,
cert_chain, cert_chain_size, 0, 0);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down Expand Up @@ -263,7 +263,7 @@ libspdm_return_t libspdm_set_certificate_ex(void *spdm_context,
status = libspdm_try_set_certificate(context, session_id, slot_id,
cert_chain, cert_chain_size,
request_attribute, key_pair_id);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down
2 changes: 1 addition & 1 deletion library/spdm_requester_lib/libspdm_req_vendor_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ libspdm_return_t libspdm_vendor_send_request_receive_response(
resp_vendor_id,
resp_size,
resp_data);
if ((status != LIBSPDM_STATUS_BUSY_PEER) || (retry == 0)) {
if (status != LIBSPDM_STATUS_BUSY_PEER) {
return status;
}

Expand Down

0 comments on commit 704d565

Please sign in to comment.