Skip to content

Commit 144178f

Browse files
UEWBotAnton-TF
authored andcommitted
mailbox: Fix MISRA complaints
Rules 10.1 and 10.4. Signed-off-by: Chris Brand <chris.brand@cypress.com> Change-Id: Ibe646e79ee261d3e124e63d13fb013964dd2179e
1 parent 047b6d7 commit 144178f

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

interface/src/multi_core/tfm_ns_mailbox.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ static uint8_t acquire_empty_slot(struct ns_mailbox_queue_t *queue)
8181
tfm_ns_mailbox_os_spin_lock();
8282
status = queue->empty_slots;
8383

84-
if (!status) {
84+
if (status == 0U) {
8585
/* No empty slot */
8686
tfm_ns_mailbox_os_spin_unlock();
8787
return NUM_MAILBOX_QUEUE_SLOT;
8888
}
8989

9090
for (idx = 0; idx < NUM_MAILBOX_QUEUE_SLOT; idx++) {
91-
if (status & (1 << idx)) {
91+
if (status & ((uint32_t)(1U << idx))) {
9292
clear_queue_slot_empty(queue, idx);
9393
break;
9494
}
@@ -181,11 +181,11 @@ int32_t tfm_ns_mailbox_client_call(uint32_t call_type,
181181
uint8_t slot_idx = NUM_MAILBOX_QUEUE_SLOT;
182182
int32_t ret;
183183

184-
if (!mailbox_queue_ptr) {
184+
if (mailbox_queue_ptr == NULL) {
185185
return MAILBOX_INIT_ERROR;
186186
}
187187

188-
if (!params || !reply) {
188+
if ((params == NULL) || (reply == NULL)) {
189189
return MAILBOX_INVAL_PARAMS;
190190
}
191191

@@ -219,15 +219,15 @@ int32_t tfm_ns_mailbox_wake_reply_owner_isr(void)
219219
mailbox_queue_status_t replied_status;
220220
uint32_t critical_section;
221221

222-
if (!mailbox_queue_ptr) {
222+
if (mailbox_queue_ptr == NULL) {
223223
return MAILBOX_INIT_ERROR;
224224
}
225225

226226
critical_section = tfm_ns_mailbox_hal_enter_critical_isr();
227227
replied_status = clear_queue_slot_all_replied(mailbox_queue_ptr);
228228
tfm_ns_mailbox_hal_exit_critical_isr(critical_section);
229229

230-
if (!replied_status) {
230+
if (replied_status == 0U) {
231231
return MAILBOX_NO_PEND_EVENT;
232232
}
233233

@@ -236,7 +236,7 @@ int32_t tfm_ns_mailbox_wake_reply_owner_isr(void)
236236
* The reply has already received from SPE mailbox but
237237
* the wake-up signal is not sent yet.
238238
*/
239-
if (!(replied_status & (0x1UL << idx))) {
239+
if ((replied_status & (0x1UL << idx)) == 0U) {
240240
continue;
241241
}
242242

@@ -249,7 +249,7 @@ int32_t tfm_ns_mailbox_wake_reply_owner_isr(void)
249249
mailbox_queue_ptr->slots_ns[idx].owner);
250250

251251
replied_status &= ~(0x1UL << idx);
252-
if (!replied_status) {
252+
if (replied_status == 0U) {
253253
break;
254254
}
255255
}

interface/src/multi_core/tfm_ns_mailbox_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ int32_t tfm_ns_mailbox_init(struct ns_mailbox_queue_t *queue)
3131

3232
/* Initialize empty bitmask */
3333
queue->empty_slots =
34-
(mailbox_queue_status_t)((1UL << (NUM_MAILBOX_QUEUE_SLOT - 1)) - 1);
34+
(mailbox_queue_status_t)((1UL << (NUM_MAILBOX_QUEUE_SLOT - 1U)) - 1U);
3535
queue->empty_slots +=
36-
(mailbox_queue_status_t)(1UL << (NUM_MAILBOX_QUEUE_SLOT - 1));
36+
(mailbox_queue_status_t)(1UL << (NUM_MAILBOX_QUEUE_SLOT - 1U));
3737

3838
mailbox_set_queue_ptr(queue);
3939

0 commit comments

Comments
 (0)