usb: usb_dc_native_posix: Check return code in handle_usb_data()
Fixes coverity complaints dealing with send() Fixes #20839 Fixes #20841 Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
parent
1d81c0cf31
commit
80dbcfa306
|
@ -561,6 +561,9 @@ int handle_usb_data(struct usbip_header *hdr)
|
|||
return -EIO;
|
||||
}
|
||||
} else {
|
||||
u8_t buf_len = usbip_ctrl.in_ep_ctrl[ep_idx].buf_len;
|
||||
u8_t *buf = usbip_ctrl.in_ep_ctrl[ep_idx].buf;
|
||||
|
||||
if (ep_idx >= USBIP_IN_EP_NUM) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -570,15 +573,18 @@ int handle_usb_data(struct usbip_header *hdr)
|
|||
|
||||
usbip_skip_setup();
|
||||
|
||||
LOG_DBG("Send %u bytes", usbip_ctrl.in_ep_ctrl[ep_idx].buf_len);
|
||||
LOG_DBG("Send %u bytes", buf_len);
|
||||
|
||||
/* Send queued data */
|
||||
usbip_send_common(ep, usbip_ctrl.in_ep_ctrl[ep_idx].buf_len);
|
||||
usbip_send(ep, usbip_ctrl.in_ep_ctrl[ep_idx].buf,
|
||||
usbip_ctrl.in_ep_ctrl[ep_idx].buf_len);
|
||||
if (!usbip_send_common(ep, buf_len)) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
LOG_HEXDUMP_DBG(usbip_ctrl.in_ep_ctrl[ep_idx].buf,
|
||||
usbip_ctrl.in_ep_ctrl[ep_idx].buf_len, ">");
|
||||
if (usbip_send(ep, buf, buf_len) != buf_len) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
LOG_HEXDUMP_DBG(buf, buf_len, ">");
|
||||
|
||||
/* Indicate data sent */
|
||||
ep_cb(ep, USB_DC_EP_DATA_IN);
|
||||
|
|
Loading…
Reference in a new issue