On 10/29/2015 10:36 AM, Peter Chen wrote:
Hi,

It is due to try to allocate memory with GFP_KERNEL at ISR, below change
can fix it, if not better solution, I can submit a patch.

diff --git a/drivers/usb/gadget/function/f_loopback.c 
b/drivers/usb/gadget/function/f_loopback.c
index 6b2102b..d2524a1 100644
--- a/drivers/usb/gadget/function/f_loopback.c
+++ b/drivers/usb/gadget/function/f_loopback.c
@@ -329,7 +329,7 @@ static int alloc_requests(struct usb_composite_dev *cdev,
        for (i = 0; i < loop->qlen && result == 0; i++) {
                result = -ENOMEM;

-               in_req = usb_ep_alloc_request(loop->in_ep, GFP_KERNEL);
+               in_req = usb_ep_alloc_request(loop->in_ep, GFP_ATOMIC);
                if (!in_req)

Well... I didn't get this error on my hardware (odroid u3+) and my "other hardware" (dummy_hcd) but agree. This function is called from set_alt() and this may be called in interrupt ctx so this should use GFP_ATOMIC as you suggested.

Best regards,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to