]> git.baikalelectronics.ru Git - kernel.git/commit
usb: gadget: dwc2: fix zlp handling
authorAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Mon, 1 Apr 2019 10:50:45 +0000 (12:50 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 6 Jun 2019 10:51:57 +0000 (13:51 +0300)
commit2b4db41c8523359df29800a6672e330e385dbb5f
tree5aaba57969f52b5424fb50db399615b99bb59bc6
parentec363d4349948937bcad61ccb635d1462051d2e5
usb: gadget: dwc2: fix zlp handling

The patch 44ec7ccfab66f15b69f6519e092b57d150d473c9
usb: dwc2: gadget: Add scatter-gather mode

avoided a NULL pointer dereference (hs_ep->req == NULL) by
calling dwc2_gadget_fill_nonisoc_xfer_dma_one() directly instead of through
the dwc2_gadget_config_nonisoc_xfer_ddma() wrapper, which unconditionally
dereferenced the said pointer.

However, this was based on an incorrect assumption that in the context of
dwc2_hsotg_program_zlp() the pointer is always NULL, which is not the case.
The result were SB CV MSC tests failing starting from Test Case 6.

Instead, this patch reverts to calling the wrapper and adds a check for
the pointer being NULL inside the wrapper.

Fixes: 44ec7ccfab66 (usb: dwc2: gadget: Add scatter-gather mode)
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc2/gadget.c