This lets the usb-msc driver send TEST UNIT READY commands.
Modified to avoid divide by zero by Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
goto fail;
// Transfer data from device.
- ret = usb_send_bulk(bulkin, USB_DIR_IN, op->buf_fl, bytes);
- if (ret)
- goto fail;
+ if (bytes) {
+ ret = usb_send_bulk(bulkin, USB_DIR_IN, op->buf_fl, bytes);
+ if (ret)
+ goto fail;
+ }
// Transfer csw info.
struct csw_s csw;
if (csw.bCSWStatus == 2)
goto fail;
- op->count -= csw.dCSWDataResidue / blocksize;
+ if (blocksize)
+ op->count -= csw.dCSWDataResidue / blocksize;
return DISK_RET_EBADTRACK;
fail: