Commit 75f0a4f2 authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: vchiq_core: simplify WARN_ON conditions

During a recent review Dan Carpenter noticed a double negation in a WARN_ON.
But a quick search revealed more unnecessary complex WARN_ON conditions.
This change should simplify them.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1622735405-9980-11-git-send-email-stefan.wahren@i2se.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 86aee79e
...@@ -924,7 +924,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service, ...@@ -924,7 +924,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
stride = calc_stride(size); stride = calc_stride(size);
WARN_ON(!(stride <= VCHIQ_SLOT_SIZE)); WARN_ON(stride > VCHIQ_SLOT_SIZE);
if (!(flags & QMFLAGS_NO_MUTEX_LOCK) && if (!(flags & QMFLAGS_NO_MUTEX_LOCK) &&
mutex_lock_killable(&state->slot_mutex)) mutex_lock_killable(&state->slot_mutex))
...@@ -1480,8 +1480,8 @@ abort_outstanding_bulks(struct vchiq_service *service, ...@@ -1480,8 +1480,8 @@ abort_outstanding_bulks(struct vchiq_service *service,
service->state->id, service->localport, is_tx ? 't' : 'r', service->state->id, service->localport, is_tx ? 't' : 'r',
queue->local_insert, queue->remote_insert, queue->process); queue->local_insert, queue->remote_insert, queue->process);
WARN_ON(!((int)(queue->local_insert - queue->process) >= 0)); WARN_ON((int)(queue->local_insert - queue->process) < 0);
WARN_ON(!((int)(queue->remote_insert - queue->process) >= 0)); WARN_ON((int)(queue->remote_insert - queue->process) < 0);
while ((queue->process != queue->local_insert) || while ((queue->process != queue->local_insert) ||
(queue->process != queue->remote_insert)) { (queue->process != queue->remote_insert)) {
...@@ -1729,7 +1729,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) ...@@ -1729,7 +1729,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
switch (type) { switch (type) {
case VCHIQ_MSG_OPEN: case VCHIQ_MSG_OPEN:
WARN_ON(!(VCHIQ_MSG_DSTPORT(msgid) == 0)); WARN_ON(VCHIQ_MSG_DSTPORT(msgid));
if (!parse_open(state, header)) if (!parse_open(state, header))
goto bail_not_ready; goto bail_not_ready;
break; break;
...@@ -1756,7 +1756,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header) ...@@ -1756,7 +1756,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
} }
break; break;
case VCHIQ_MSG_CLOSE: case VCHIQ_MSG_CLOSE:
WARN_ON(size != 0); /* There should be no data */ WARN_ON(size); /* There should be no data */
vchiq_log_info(vchiq_core_log_level, vchiq_log_info(vchiq_core_log_level,
"%d: prs CLOSE@%pK (%d->%d)", "%d: prs CLOSE@%pK (%d->%d)",
...@@ -1958,7 +1958,7 @@ parse_rx_slots(struct vchiq_state *state) ...@@ -1958,7 +1958,7 @@ parse_rx_slots(struct vchiq_state *state)
if (!state->rx_data) { if (!state->rx_data) {
int rx_index; int rx_index;
WARN_ON(!((state->rx_pos & VCHIQ_SLOT_MASK) == 0)); WARN_ON(state->rx_pos & VCHIQ_SLOT_MASK);
rx_index = remote->slot_queue[ rx_index = remote->slot_queue[
SLOT_QUEUE_INDEX_FROM_POS_MASKED(state->rx_pos)]; SLOT_QUEUE_INDEX_FROM_POS_MASKED(state->rx_pos)];
state->rx_data = (char *)SLOT_DATA_FROM_INDEX(state, state->rx_data = (char *)SLOT_DATA_FROM_INDEX(state,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment