Skip to content

Commit

Permalink
Fix check-warns from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ayla-nordicsemi committed Dec 5, 2024
1 parent 377ef70 commit a232655
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
6 changes: 3 additions & 3 deletions include/sdfw/sdfw_services/device_info_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
/** .. include_startingpoint_device_info_header_rst */
/**
* @brief Read UUID value.
*
* @note UUID is provided in words, byte order is the same as
*
* @note UUID is provided in words, byte order is the same as
* read from the memory and no endianness swapping is performed.
*
* @param[out] uuid_words Local buffer for copying the UUID words into.
* @param[in] uuid_words_count Size of local buffer, should be at least 4 words.
*
* @return 0 on success, otherwise a negative errno.
*/
int ssf_device_info_get_uuid(uint32_t* uuid_words, size_t uuid_words_count);
int ssf_device_info_get_uuid(uint32_t *uuid_words, size_t uuid_words_count);

/** .. include_endpoint_device_info_header_rst */

Expand Down
30 changes: 19 additions & 11 deletions subsys/sdfw_services/services/device_info/device_info_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ int ssf_device_info_get_uuid(uint32_t *uuid_words, size_t uuid_words_count)
int err = -1; /* initialize with negative value for error */

if ((NULL != uuid_words) && (uuid_words_count >= UUID_BYTES_LENGTH)) {
// valid parameters
int ret = -1; /* initialize with negative value for error */
const uint8_t *rsp_pkt; /* For freeing response packet after copying rsp_str. */

struct device_info_service_read_req uuid_read_req = {
.device_info_service_read_req_target.device_info_target_choice = device_info_target_UUID_c,
.device_info_service_read_req_target.device_info_target_choice =

Check failure on line 37 in subsys/sdfw_services/services/device_info/device_info_service.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

TRAILING_WHITESPACE

subsys/sdfw_services/services/device_info/device_info_service.c:37 trailing whitespace
device_info_target_UUID_c,
};

struct device_info_req read_req = {
.device_info_req_msg_choice = device_info_req_msg_device_info_service_read_req_m_c,
.device_info_req_msg_choice =
device_info_req_msg_device_info_service_read_req_m_c,
.device_info_req_msg_device_info_service_read_req_m = uuid_read_req
};

Expand All @@ -50,32 +51,39 @@ int ssf_device_info_get_uuid(uint32_t *uuid_words, size_t uuid_words_count)
return err;
}

struct device_info_service_read_resp uuid_read_resp = read_resp.device_info_resp_msg_device_info_service_read_resp_m;
if (read_resp.device_info_resp_msg_choice == device_info_resp_msg_device_info_service_read_resp_m_c) {
if (device_info_target_UUID_c == uuid_read_resp.device_info_service_read_resp_target.device_info_target_choice) {
ret = read_resp.device_info_resp_msg_device_info_service_read_resp_m.device_info_service_read_resp_status.device_info_status_choice;
struct device_info_service_read_resp uuid_read_resp =
read_resp.device_info_resp_msg_device_info_service_read_resp_m;
if (read_resp.device_info_resp_msg_choice ==
device_info_resp_msg_device_info_service_read_resp_m_c) {
if (device_info_target_UUID_c ==
uuid_read_resp.device_info_service_read_resp_target.device_info_target_choice) {

Check warning on line 59 in subsys/sdfw_services/services/device_info/device_info_service.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

subsys/sdfw_services/services/device_info/device_info_service.c:59 line length of 112 exceeds 100 columns
ret = read_resp.
device_info_resp_msg_device_info_service_read_resp_m.

Check warning on line 61 in subsys/sdfw_services/services/device_info/device_info_service.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

MULTILINE_DEREFERENCE

subsys/sdfw_services/services/device_info/device_info_service.c:61 Avoid multiple line dereference - prefer 'read_resp.device_info_resp_msg_device_info_service_read_resp_m'
device_info_service_read_resp_status.device_info_status_choice;

Check warning on line 62 in subsys/sdfw_services/services/device_info/device_info_service.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

subsys/sdfw_services/services/device_info/device_info_service.c:62 line length of 103 exceeds 100 columns

Check warning on line 62 in subsys/sdfw_services/services/device_info/device_info_service.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

MULTILINE_DEREFERENCE

subsys/sdfw_services/services/device_info/device_info_service.c:62 Avoid multiple line dereference - prefer 'device_info_resp_msg_device_info_service_read_resp_m.device_info_service_read_resp_status.device_info_status_choice'
if (device_info_status_SUCCESS_c != ret) {
ssf_client_decode_done(rsp_pkt);
return ret;
}
} else {
// not a read UUID response
/* not a read UUID response */
ssf_client_decode_done(rsp_pkt);
return device_info_status_INTERNAL_ERROR_c;
}

} else {
// not a read response
/* not a read response */
ssf_client_decode_done(rsp_pkt);
return device_info_status_INTERNAL_ERROR_c;
}

size_t uuid_words_len = uuid_read_resp.device_info_service_read_resp_data_uint_count;

Check warning on line 79 in subsys/sdfw_services/services/device_info/device_info_service.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LONG_LINE

subsys/sdfw_services/services/device_info/device_info_service.c:79 line length of 101 exceeds 100 columns
memcpy(uuid_words, uuid_read_resp.device_info_service_read_resp_data_uint, uuid_words_len * sizeof(uint32_t));
memcpy(uuid_words,

Check warning on line 80 in subsys/sdfw_services/services/device_info/device_info_service.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LINE_SPACING

subsys/sdfw_services/services/device_info/device_info_service.c:80 Missing a blank line after declarations
uuid_read_resp.device_info_service_read_resp_data_uint,
uuid_words_len * sizeof(uint32_t));

ssf_client_decode_done(rsp_pkt);
} else {
// invalid parameters
/* invalid parameters */
err = -1;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
; .. include_startingpoint_device_info_cddl_rst

device_info_status = (SUCCESS: 0) /
(INTERNAL_ERROR: 16781313) /
(INTERNAL_ERROR: 16781313) /
(UNPROGRAMMED: 16781314)

device_info_target = (UUID: 0) /
device_info_target = (UUID: 0) /
(TYPE: 1) /
(TESTIMPRINT: 2) /
(PARTNO: 3) /
Expand Down

0 comments on commit a232655

Please sign in to comment.