Skip to content

Commit be0a4b6

Browse files
xiaoguangwuacrnsi
authored andcommitted
DM USB: fix enumeration related issues
The patch fixes enumeration related issues introduced by commit 'fc3d19'. Tracked-On: #3612 Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Acked-by: Yu Wang <yu1.wang@intel.com>
1 parent e7179aa commit be0a4b6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

devicemodel/hw/platform/usb_pmapper.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -962,11 +962,6 @@ usb_dev_request(void *pdata, struct usb_data_xfer *xfer)
962962

963963
blk = usb_dev_prepare_ctrl_xfer(xfer);
964964
data = blk ? blk->buf : NULL;
965-
if (data == NULL) {
966-
xfer->status = USB_ERR_IOERROR;
967-
UPRINTF(LFTL, "%s unexpected NULL data\r\n", __func__);
968-
goto out;
969-
}
970965

971966
UPRINTF(LDBG, "%d-%s: urb: type 0x%x req 0x%x val 0x%x idx %d len %d "
972967
"data %d\r\n", udev->info.path.bus,
@@ -1016,6 +1011,13 @@ usb_dev_request(void *pdata, struct usb_data_xfer *xfer)
10161011

10171012
}
10181013

1014+
/* (data == NULL && len == 0) is okey to libusb_control_transfer */
1015+
if (data == NULL && len) {
1016+
xfer->status = USB_ERR_IOERROR;
1017+
UPRINTF(LFTL, "%s unexpected NULL data\r\n", __func__);
1018+
goto out;
1019+
}
1020+
10191021
/* send it to physical device */
10201022
/* FIXME: In the process of implementation of USB isochronouse transfer,
10211023
* the timeout time is not enough for Plantronics headset. So this
@@ -1029,7 +1031,7 @@ usb_dev_request(void *pdata, struct usb_data_xfer *xfer)
10291031
* supported and the following code is used as a workaround now.
10301032
* UAS will be implemented in future.
10311033
*/
1032-
if (need_chk_uas)
1034+
if (need_chk_uas && data)
10331035
clear_uas_desc(udev, data, rc);
10341036

10351037
if (rc >= 0 && blk) {

0 commit comments

Comments
 (0)