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

Commit 5306d4b7 authored by Udipto Goswami's avatar Udipto Goswami Committed by Gerrit - the friendly Code Review server
Browse files

usb: f_qdss: Return -EINVAL instead of -EAGAIN if debug_inface is enabled



Currently if a target uses a composition where both ctrl & data
interface exists, then debug_inface is enabled from userspace. The
f_qdss driver checks for debug_inface_enabled in alloc_req. If the
variable is set then it populates the ctrl_write_pool instead of
data_write_pool. Due to this when qdss_write is called it finds
data_write_pool empty & it will return error message.
However, coresight driver will still request continuously for
qdss_write irrespective of ctrl or data pool. This eventually results
in excessive logging & the device might crash giving watchdog bark
error.

To avoid continuous request, instead of returning -EAGAIN check for
debug_inface_enabled along with empty status of ctrl_data_pool,
data_write_pool and returning -EINVAL.

Change-Id: I8cc6f0f4f2d2b880326c2322d5d907b332ab771b
Signed-off-by: default avatarUdipto Goswami <ugoswami@codeaurora.org>
parent 757f1d14
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -854,8 +854,22 @@ int usb_qdss_write(struct usb_qdss_ch *ch, struct qdss_request *d_req)
		return -EIO;
	}

	/* If data_write_pool is empty & debug inface is set
	 * then return -EINVAL instead of -EAGAIN.
	 * qdss_write is expecting data_write_pool to
	 * be populated. But data_write_pool is populated only
	 * when debug_inface_enbled is not set.
	 */
	if (list_empty(&qdss->data_write_pool) &&
	    qdss->debug_inface_enabled) {
		pr_err("%s:error: Invalid operation.\n", __func__);
		spin_unlock_irqrestore(&qdss->lock, flags);
		return -EINVAL;
	}

	if (list_empty(&qdss->data_write_pool)) {
		pr_err("error: usb_qdss_data_write list is empty\n");
		pr_err_ratelimited(
			"error: usb_qdss_data_write list is empty\n");
		spin_unlock_irqrestore(&qdss->lock, flags);
		return -EAGAIN;
	}