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

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

Merge "diag: Release wake source properly"

parents 006d3349 6b8562f0
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -727,11 +727,13 @@ static int diag_smd_read(void *ctxt, unsigned char *buf, int buf_len)
	    !atomic_read(&smd_info->opened))
		return -EIO;

	/*
	 * Always try to read the data if notification is received from smd
	 * In case if packet size is 0 release the wake source hold earlier
	 */
	err = wait_event_interruptible(smd_info->read_wait_q,
				       (smd_info->hdl == NULL) ||
				       (atomic_read(&smd_info->opened) == 0) ||
				       (smd_cur_packet_size(smd_info->hdl)) ||
				       (!atomic_read(&smd_info->diag_state)));
				       (smd_info->hdl != NULL) &&
				       (atomic_read(&smd_info->opened) == 1));
	if (err) {
		diagfwd_channel_read_done(smd_info->fwd_ctxt, buf, 0);
		return -ERESTARTSYS;