usb: Don't pass negative length values to e1_line_demux_in()

every so often, the USB transfer completes without data (due to
"unlucky" time alignment between E1 and USB frame clock).  Don't
call the demuxer in that case.

Otherwise the user is confused by error messages like

<0001> intf_line.c:467 (I0:L0) IN ERROR: -4

Change-Id: Ia99f97c2cca44d15a83a54cebe884b343ec44f46
This commit is contained in:
Harald Welte 2020-09-01 09:36:04 +02:00
parent 569726a72f
commit 51e12ad603
1 changed files with 2 additions and 0 deletions

View File

@ -107,6 +107,8 @@ struct e1_usb_flow {
static int
e1_usb_xfer_in(struct e1_usb_flow *flow, uint8_t *buf, int size)
{
if (size == 0)
return 0;
return e1_line_demux_in(flow->line, buf + 4, size - 4);
}