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

Commit 58d59039 authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: gadget: gps: Handle case when response queue is empty



When there is no packet available in response queue on device
side and host requests for GET_ENCAPSULATED response on control
endpoint, gps_setup() API returns as -EOPNOTSUPP. This results
into controller driver stalling EP0 OUT endpoint which host
side driver may not expected. Hence to avoid this stalling of
EP0 OUT endpoint returns zero instead of -EOPNOTSUPP from
gps_setup() API.

Also use pr_debug() instead of pr_err() when there is no control
response packet available as it is not actual error but condition
where there is no data available to send.

CRs-Fixed: 995861
Change-Id: I6ac58ba5d1cb895f5d49e5df3f4d7257dc9a628c
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent fbfdd7c9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2011-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
@@ -560,8 +560,9 @@ gps_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)

			spin_lock(&dev->lock);
			if (list_empty(&dev->cpkt_resp_q)) {
				pr_err("%s: ctrl resp queue empty", __func__);
				spin_unlock(&dev->lock);
				pr_debug("%s: ctrl resp queue empty", __func__);
				ret = 0;
				goto invalid;
			}