• Andrzej Pietrasiewicz's avatar
    usb: gadget: dwc2: fix zlp handling · 066cfd07
    Andrzej Pietrasiewicz authored
    The patch 10209abe
    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: 10209abe (usb: dwc2: gadget: Add scatter-gather mode)
    Acked-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
    Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@collabora.com>
    Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
    066cfd07
gadget.c 137 KB