From patchwork Thu Dec 1 09:02:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 85990 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp600714qgi; Thu, 1 Dec 2016 01:13:35 -0800 (PST) X-Received: by 10.99.207.17 with SMTP id j17mr65536063pgg.57.1480583615049; Thu, 01 Dec 2016 01:13:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r39si39951350pld.153.2016.12.01.01.13.34; Thu, 01 Dec 2016 01:13:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758173AbcLAJNc (ORCPT + 4 others); Thu, 1 Dec 2016 04:13:32 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:36046 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757381AbcLAJNb (ORCPT ); Thu, 1 Dec 2016 04:13:31 -0500 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OHI02F5013EQK70@mailout3.samsung.com>; Thu, 01 Dec 2016 18:02:28 +0900 (KST) X-AuditID: cbfee61a-f79916d0000062de-dd-583fe7242310 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 5C.04.25310.427EF385; Thu, 1 Dec 2016 18:02:28 +0900 (KST) Received: from AMDC2765.digital.local ([106.116.147.25]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OHI00I8313XQ1A0@mmp1.samsung.com>; Thu, 01 Dec 2016 18:02:28 +0900 (KST) From: Marek Szyprowski To: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , John Youn , Bartlomiej Zolnierkiewicz , Felipe Balbi Subject: [PATCH] usb: dwc2: fix flags for DMA descriptor allocation in dwc2_hsotg_ep_enable Date: Thu, 01 Dec 2016 10:02:11 +0100 Message-id: <1480582931-24433-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJLMWRmVeSWpSXmKPExsVy+t9jAV2V5/YRBh92KVhsnLGe1eJY2xN2 i92nLzFaXN41h81i0bJWZou1R+6yO7B5bFrVyebRt2UVo8eW/Z8ZPT5vkgtgiXKzyUhNTEkt UkjNS85PycxLt1UKDXHTtVBSyEvMTbVVitD1DQlSUihLzCkF8owM0ICDc4B7sJK+XYJbxpKv jSwFr6UqNt3La2CcI9HFyMkhIWAi8ffIGRYIW0ziwr31bF2MXBxCAksZJdZ/u8MI4fxilFh4 4BZYFZuAoUTX2y6gKg4OEQFrib6DQSA1zALrGSVe7HzGDFIjLBArsb+njQ3EZhFQlVi68hQT SD2vgIfE3K9VEMvkJE4em8w6gZF7ASPDKkaJ1ILkguKk9FzDvNRyveLE3OLSvHS95PzcTYzg YHwmtYPx4C73Q4wCHIxKPLwL4uwjhFgTy4orcw8xSnAwK4nw1j0GCvGmJFZWpRblxxeV5qQW H2I0Bdo/kVlKNDkfGCl5JfGGJuYm5sYGFuaWliZGSuK8jbOfhQsJpCeWpGanphakFsH0MXFw SjUwsi+odCu68VxipptW87HnTEdZDxwUDPJpPKXcVLXp/N1Nsx+Vtx78efTllr0bjndOPdF9 bGNFnAHn3/vRUnztc9jqLx98tpBhgr3c7aU1q68veiiiyNBc+slD5XJgX7hG2rTou0oWUeoJ gstl17x5usGjmO+ftoRBzufvShfL31+z5Cq+fulVvBJLcUaioRZzUXEiAH7b5YFcAgAA X-MTR: 20000000000000000@CPGS Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org dwc2_hsotg_ep_enable can be called from interrupt context, so all allocations should be done with GFP_ATOMIC flags. This fixes following issue on ARM architecture: [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x74/0x94) [] (dump_stack) from [] (__warn+0xd4/0x100) [] (__warn) from [] (warn_slowpath_null+0x20/0x28) [] (warn_slowpath_null) from [] (smp_call_function_many+0xcc/0x2a4) [] (smp_call_function_many) from [] (on_each_cpu_mask+0x38/0xa8) [] (on_each_cpu_mask) from [] (start_isolate_page_range+0x134/0x1b8) [] (start_isolate_page_range) from [] (alloc_contig_range+0xac/0x2f8) [] (alloc_contig_range) from [] (cma_alloc+0xe0/0x1a8) [] (cma_alloc) from [] (__alloc_from_contiguous+0x38/0xe0) [] (__alloc_from_contiguous) from [] (cma_allocator_alloc+0x30/0x38) [] (cma_allocator_alloc) from [] (__dma_alloc+0x1c0/0x2c8) [] (__dma_alloc) from [] (arm_dma_alloc+0x3c/0x48) [] (arm_dma_alloc) from [] (dwc2_hsotg_ep_enable+0xec/0x46c) [] (dwc2_hsotg_ep_enable) from [] (usb_ep_enable+0x2c/0x3c) [] (usb_ep_enable) from [] (ecm_set_alt+0xa8/0x154) [] (ecm_set_alt) from [] (composite_setup+0xd74/0x1540) [] (composite_setup) from [] (dwc2_hsotg_complete_setup+0xb8/0x370) [] (dwc2_hsotg_complete_setup) from [] (usb_gadget_giveback_request+0xc/0x10) [] (usb_gadget_giveback_request) from [] (dwc2_hsotg_complete_request+0x78/0x128) [] (dwc2_hsotg_complete_request) from [] (dwc2_hsotg_epint+0x69c/0x81c) [] (dwc2_hsotg_epint) from [] (dwc2_hsotg_irq+0xfc/0x748) [] (dwc2_hsotg_irq) from [] (__handle_irq_event_percpu+0x58/0x140) [] (__handle_irq_event_percpu) from [] (handle_irq_event_percpu+0x1c/0x58) [] (handle_irq_event_percpu) from [] (handle_irq_event+0x38/0x5c) [] (handle_irq_event) from [] (handle_fasteoi_irq+0xc4/0x19c) [] (handle_fasteoi_irq) from [] (generic_handle_irq+0x18/0x28) [] (generic_handle_irq) from [] (__handle_domain_irq+0x6c/0xe4) [] (__handle_domain_irq) from [] (gic_handle_irq+0x50/0x9c) [] (gic_handle_irq) from [] (__irq_svc+0x6c/0xa8) Fixes: 5f54c54b0ba83 ("usb: dwc2: gadget: Add DDMA chain pointers to dwc2_hsotg_ep structure") Signed-off-by: Marek Szyprowski --- drivers/usb/dwc2/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index b95930f20d90..c55db4aa54d6 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3753,7 +3753,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, hs_ep->desc_list = dma_alloc_coherent(hsotg->dev, MAX_DMA_DESC_NUM_GENERIC * sizeof(struct dwc2_dma_desc), - &hs_ep->desc_list_dma, GFP_KERNEL); + &hs_ep->desc_list_dma, GFP_ATOMIC); if (!hs_ep->desc_list) { ret = -ENOMEM; goto error2;