Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d602672 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: hab: add rx queue empty check after getting the lock"

parents d8bc349f bc856c7c
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -64,9 +64,14 @@ hab_msg_dequeue(struct virtual_channel *vchan, struct hab_message **msg,
		}
	}

	/* return all the received messages before the remote close */
	if ((!ret || (ret == -ERESTARTSYS)) && !hab_rx_queue_empty(vchan)) {
	/*
	 * return all the received messages before the remote close,
	 * and need empty check again in case the list is empty now due to
	 * dequeue by other threads
	 */
	spin_lock_bh(&vchan->rx_lock);

	if ((!ret || (ret == -ERESTARTSYS)) && !list_empty(&vchan->rx_list)) {
		message = list_first_entry(&vchan->rx_list,
				struct hab_message, node);
		if (message) {
@@ -84,11 +89,12 @@ hab_msg_dequeue(struct virtual_channel *vchan, struct hab_message **msg,
				ret = -EOVERFLOW; /* come back again */
			}
		}
		spin_unlock_bh(&vchan->rx_lock);
	} else
		/* no message received, retain the original status */
		*rsize = 0;

	spin_unlock_bh(&vchan->rx_lock);

	*msg = message;
	return ret;
}