mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 14:33:38 +00:00
DM USB: clean up the assert usage
Remove assert in USB mediator code. Tracked-On: #3252 Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com> Reviewed-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
parent
7e6ff2a176
commit
31e23cd09c
@ -492,9 +492,6 @@ pci_xhci_get_free_vport(struct pci_xhci_vdev *xdev,
|
||||
int ports, porte;
|
||||
int i, j, k;
|
||||
|
||||
assert(xdev);
|
||||
assert(di);
|
||||
|
||||
if (di->bcd < 0x300)
|
||||
ports = xdev->usb2_port_start;
|
||||
else
|
||||
@ -524,10 +521,6 @@ pci_xhci_set_native_port_assigned(struct pci_xhci_vdev *xdev,
|
||||
{
|
||||
int i;
|
||||
|
||||
assert(xdev);
|
||||
assert(info);
|
||||
assert(xdev->native_ports);
|
||||
|
||||
for (i = 0; i < XHCI_MAX_VIRT_PORTS; i++)
|
||||
if (xdev->native_ports[i].state == VPORT_FREE)
|
||||
break;
|
||||
@ -547,9 +540,6 @@ pci_xhci_get_native_port_index_by_path(struct pci_xhci_vdev *xdev,
|
||||
{
|
||||
int i;
|
||||
|
||||
assert(xdev);
|
||||
assert(path);
|
||||
|
||||
for (i = 0; i < XHCI_MAX_VIRT_PORTS; i++)
|
||||
if (usb_dev_path_cmp(&xdev->native_ports[i].info.path, path))
|
||||
return i;
|
||||
@ -562,7 +552,6 @@ pci_xhci_get_native_port_index_by_vport(struct pci_xhci_vdev *xdev,
|
||||
{
|
||||
int i;
|
||||
|
||||
assert(xdev);
|
||||
for (i = 0; i < XHCI_MAX_VIRT_PORTS; i++)
|
||||
if (xdev->native_ports[i].vport == vport)
|
||||
return i;
|
||||
@ -576,10 +565,6 @@ pci_xhci_clr_native_port_assigned(struct pci_xhci_vdev *xdev,
|
||||
{
|
||||
int i;
|
||||
|
||||
assert(xdev);
|
||||
assert(info);
|
||||
assert(xdev->native_ports);
|
||||
|
||||
i = pci_xhci_get_native_port_index_by_path(xdev, &info->path);
|
||||
if (i >= 0) {
|
||||
xdev->native_ports[i].state = VPORT_FREE;
|
||||
@ -687,8 +672,6 @@ xhci_vbdp_thread(void *data)
|
||||
struct pci_xhci_native_port *p;
|
||||
|
||||
xdev = data;
|
||||
assert(xdev);
|
||||
|
||||
while (xdev->vbdp_polling) {
|
||||
|
||||
sem_wait(&xdev->vbdp_sem);
|
||||
@ -730,12 +713,6 @@ pci_xhci_native_usb_dev_conn_cb(void *hci_data, void *dev_data)
|
||||
int s3_conn = 0;
|
||||
|
||||
xdev = hci_data;
|
||||
|
||||
assert(xdev);
|
||||
assert(dev_data);
|
||||
assert(xdev->devices);
|
||||
assert(xdev->slots);
|
||||
|
||||
di = dev_data;
|
||||
|
||||
/* print physical information about new device */
|
||||
@ -821,12 +798,7 @@ pci_xhci_native_usb_dev_disconn_cb(void *hci_data, void *dev_data)
|
||||
int rc;
|
||||
int i;
|
||||
|
||||
assert(hci_data);
|
||||
assert(dev_data);
|
||||
|
||||
xdev = hci_data;
|
||||
assert(xdev->devices);
|
||||
|
||||
di = dev_data;
|
||||
if (!pci_xhci_is_valid_portnum(ROOTHUB_PORT(di->path))) {
|
||||
UPRINTF(LFTL, "invalid physical port %d\r\n",
|
||||
@ -890,7 +862,9 @@ pci_xhci_native_usb_dev_disconn_cb(void *hci_data, void *dev_data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(state == VPORT_EMULATED || state == VPORT_CONNECTED);
|
||||
if (!(state == VPORT_EMULATED || state == VPORT_CONNECTED))
|
||||
UPRINTF(LFTL, "error: unexpected state %d\r\n", state);
|
||||
|
||||
xdev->native_ports[index].state = VPORT_ASSIGNED;
|
||||
xdev->native_ports[index].vport = 0;
|
||||
|
||||
@ -1003,9 +977,6 @@ pci_xhci_dev_create(struct pci_xhci_vdev *xdev, void *dev_data)
|
||||
void *ud = NULL;
|
||||
int rc;
|
||||
|
||||
assert(xdev);
|
||||
assert(dev_data);
|
||||
|
||||
ue = calloc(1, sizeof(struct usb_devemu));
|
||||
if (!ue)
|
||||
return NULL;
|
||||
@ -1077,7 +1048,6 @@ pci_xhci_dev_destroy(struct pci_xhci_dev_emu *de)
|
||||
ud = de->dev_instance;
|
||||
if (ue) {
|
||||
if (ue->ue_devtype == USB_DEV_PORT_MAPPER) {
|
||||
assert(ue->ue_deinit);
|
||||
if (ue->ue_deinit)
|
||||
ue->ue_deinit(ud);
|
||||
}
|
||||
@ -1142,8 +1112,6 @@ pci_xhci_change_port(struct pci_xhci_vdev *xdev, int port, int usb_speed,
|
||||
struct xhci_trb evtrb;
|
||||
struct pci_xhci_portregs *reg;
|
||||
|
||||
assert(xdev != NULL);
|
||||
|
||||
reg = XHCI_PORTREG_PTR(xdev, port);
|
||||
if (conn == 0) {
|
||||
reg->portsc &= ~(XHCI_PS_CCS | XHCI_PS_PED);
|
||||
@ -1295,11 +1263,8 @@ pci_xhci_portregs_write(struct pci_xhci_vdev *xdev,
|
||||
UPRINTF(LDBG, "portregs wr offset 0x%lx, port %u: 0x%lx\r\n",
|
||||
offset, port, value);
|
||||
|
||||
assert(port >= 0);
|
||||
|
||||
if (port > XHCI_MAX_DEVS) {
|
||||
UPRINTF(LWRN, "portregs_write port %d > ndevices\r\n",
|
||||
port);
|
||||
if (port > XHCI_MAX_DEVS || port < 0) {
|
||||
UPRINTF(LWRN, "portregs_write to bad port %d\r\n", port);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1416,10 +1381,7 @@ pci_xhci_apl_drdregs_write(struct pci_xhci_vdev *xdev, uint64_t offset,
|
||||
struct pci_xhci_excap *excap;
|
||||
struct pci_xhci_excap_drd_apl *excap_drd;
|
||||
|
||||
assert(xdev);
|
||||
|
||||
excap = xdev->excap_ptr;
|
||||
|
||||
while (excap && excap->start != XHCI_APL_DRDCAP_BASE)
|
||||
excap++;
|
||||
|
||||
@ -1485,8 +1447,6 @@ pci_xhci_excap_write(struct pci_xhci_vdev *xdev, uint64_t offset,
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
assert(xdev);
|
||||
|
||||
if (xdev->excap_ptr && xdev->excap_write)
|
||||
rc = xdev->excap_write(xdev, offset, value);
|
||||
else
|
||||
@ -1503,9 +1463,13 @@ pci_xhci_get_dev_ctx(struct pci_xhci_vdev *xdev, uint32_t slot)
|
||||
uint64_t devctx_addr;
|
||||
struct xhci_dev_ctx *devctx;
|
||||
|
||||
assert(slot > 0 && slot <= XHCI_MAX_SLOTS &&
|
||||
xdev->slot_allocated[slot]);
|
||||
assert(xdev->opregs.dcbaa_p != NULL);
|
||||
if (slot <= 0 || slot > XHCI_MAX_SLOTS || !xdev->slot_allocated[slot] ||
|
||||
!xdev->opregs.dcbaa_p) {
|
||||
UPRINTF(LFTL, "invalid ctx: slot %d, alloc %d dcbaa %p\r\n",
|
||||
slot, xdev->slot_allocated[slot],
|
||||
xdev->opregs.dcbaa_p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
devctx_addr = xdev->opregs.dcbaa_p->dcba[slot];
|
||||
|
||||
@ -1528,8 +1492,6 @@ pci_xhci_trb_next(struct pci_xhci_vdev *xdev,
|
||||
{
|
||||
struct xhci_trb *next;
|
||||
|
||||
assert(curtrb != NULL);
|
||||
|
||||
if (XHCI_TRB_3_TYPE_GET(curtrb->dwTrb3) == XHCI_TRB_TYPE_LINK) {
|
||||
if (guestaddr)
|
||||
*guestaddr = curtrb->qwTrb0 & ~0xFUL;
|
||||
@ -1606,7 +1568,6 @@ pci_xhci_init_ep(struct pci_xhci_dev_emu *dev, int epid)
|
||||
if (pstreams > 0) {
|
||||
UPRINTF(LDBG, "init_ep %d with pstreams %d\r\n",
|
||||
epid, pstreams);
|
||||
assert(devep->ep_sctx_trbs == NULL);
|
||||
|
||||
devep->ep_sctx = XHCI_GADDR(dev->xdev, ep_ctx->qwEpCtx2 &
|
||||
XHCI_EPCTX_2_TR_DQ_PTR_MASK);
|
||||
@ -1839,7 +1800,6 @@ pci_xhci_cmd_disable_slot(struct pci_xhci_vdev *xdev, uint32_t slot)
|
||||
XHCI_PS_CCS | XHCI_PS_PED | XHCI_PS_PP);
|
||||
|
||||
udev = dev->dev_instance;
|
||||
assert(udev);
|
||||
|
||||
xdev->devices[i] = NULL;
|
||||
xdev->slots[slot] = NULL;
|
||||
@ -2024,7 +1984,6 @@ pci_xhci_cmd_address_device(struct pci_xhci_vdev *xdev,
|
||||
dev_ctx->ctx_slot.dwSctx2, dev_ctx->ctx_slot.dwSctx3);
|
||||
|
||||
dev = XHCI_SLOTDEV_PTR(xdev, slot);
|
||||
assert(dev != NULL);
|
||||
|
||||
dev->hci.hci_address = slot;
|
||||
dev->dev_ctx = dev_ctx;
|
||||
@ -2225,7 +2184,6 @@ pci_xhci_cmd_reset_ep(struct pci_xhci_vdev *xdev,
|
||||
type = XHCI_TRB_3_TYPE_GET(trb->dwTrb3);
|
||||
|
||||
dev = XHCI_SLOTDEV_PTR(xdev, slot);
|
||||
assert(dev != NULL);
|
||||
|
||||
if (type == XHCI_TRB_TYPE_STOP_EP &&
|
||||
(trb->dwTrb3 & XHCI_TRB_3_SUSP_EP_BIT) != 0) {
|
||||
@ -2239,7 +2197,6 @@ pci_xhci_cmd_reset_ep(struct pci_xhci_vdev *xdev,
|
||||
}
|
||||
|
||||
dev_ctx = dev->dev_ctx;
|
||||
assert(dev_ctx != NULL);
|
||||
ep_ctx = &dev_ctx->ctx_ep[epid];
|
||||
|
||||
if (type == XHCI_TRB_TYPE_RESET_EP &&
|
||||
@ -2326,8 +2283,6 @@ pci_xhci_cmd_set_tr(struct pci_xhci_vdev *xdev,
|
||||
cmderr = XHCI_TRB_ERROR_SUCCESS;
|
||||
|
||||
dev = XHCI_SLOTDEV_PTR(xdev, slot);
|
||||
assert(dev != NULL);
|
||||
|
||||
UPRINTF(LDBG, "set_tr: new-tr x%016lx, SCT %u DCS %u\r\n"
|
||||
" stream-id %u, slot %u, epid %u, C %u\r\n",
|
||||
(trb->qwTrb0 & ~0xF), (uint32_t)((trb->qwTrb0 >> 1) & 0x7),
|
||||
@ -2343,8 +2298,6 @@ pci_xhci_cmd_set_tr(struct pci_xhci_vdev *xdev,
|
||||
}
|
||||
|
||||
dev_ctx = dev->dev_ctx;
|
||||
assert(dev_ctx != NULL);
|
||||
|
||||
ep_ctx = &dev_ctx->ctx_ep[epid];
|
||||
devep = &dev->eps[epid];
|
||||
|
||||
@ -2366,7 +2319,6 @@ pci_xhci_cmd_set_tr(struct pci_xhci_vdev *xdev,
|
||||
sctx = NULL;
|
||||
cmderr = pci_xhci_find_stream(xdev, ep_ctx, streamid, &sctx);
|
||||
if (sctx != NULL) {
|
||||
assert(devep->ep_sctx != NULL);
|
||||
|
||||
devep->ep_sctx[streamid].qwSctx0 = trb->qwTrb0;
|
||||
devep->ep_sctx_trbs[streamid].ringaddr =
|
||||
@ -2661,7 +2613,6 @@ pci_xhci_xfer_complete(struct pci_xhci_vdev *xdev,
|
||||
int rem_len = 0;
|
||||
|
||||
dev_ctx = pci_xhci_get_dev_ctx(xdev, slot);
|
||||
assert(dev_ctx != NULL);
|
||||
|
||||
ep_ctx = &dev_ctx->ctx_ep[epid];
|
||||
|
||||
@ -3425,8 +3376,6 @@ pci_xhci_write(struct vmctx *ctx,
|
||||
|
||||
xdev = dev->arg;
|
||||
|
||||
assert(baridx == 0);
|
||||
|
||||
pthread_mutex_lock(&xdev->mtx);
|
||||
if (offset < XHCI_CAPLEN) /* read only registers */
|
||||
UPRINTF(LWRN, "write RO-CAPs offset %ld\r\n", offset);
|
||||
@ -3614,8 +3563,6 @@ pci_xhci_rtsregs_read(struct pci_xhci_vdev *xdev, uint64_t offset)
|
||||
offset -= XHCI_RT_IR_BASE;
|
||||
item = offset % 32;
|
||||
|
||||
assert(offset < sizeof(xdev->rtsregs.intrreg));
|
||||
|
||||
p = &xdev->rtsregs.intrreg.iman;
|
||||
p += item / sizeof(uint32_t);
|
||||
value = *p;
|
||||
@ -3634,8 +3581,6 @@ pci_xhci_excap_read(struct pci_xhci_vdev *xdev, uint64_t offset)
|
||||
uint32_t off = offset;
|
||||
struct pci_xhci_excap *excap;
|
||||
|
||||
assert(xdev);
|
||||
|
||||
excap = xdev->excap_ptr;
|
||||
|
||||
while (excap && excap->start != EXCAP_GROUP_END) {
|
||||
@ -3672,8 +3617,6 @@ pci_xhci_read(struct vmctx *ctx,
|
||||
|
||||
xdev = dev->arg;
|
||||
|
||||
assert(baridx == 0);
|
||||
|
||||
pthread_mutex_lock(&xdev->mtx);
|
||||
if (offset < XHCI_CAPLEN)
|
||||
value = pci_xhci_hostcap_read(xdev, offset);
|
||||
@ -3716,8 +3659,6 @@ pci_xhci_reset_port(struct pci_xhci_vdev *xdev, int portn, int warm)
|
||||
int speed, error;
|
||||
int index;
|
||||
|
||||
assert(portn <= XHCI_MAX_DEVS);
|
||||
|
||||
UPRINTF(LINF, "reset port %d\r\n", portn);
|
||||
|
||||
port = XHCI_PORTREG_PTR(xdev, portn);
|
||||
@ -3774,8 +3715,6 @@ pci_xhci_dev_intr(struct usb_hci *hci, int epctx)
|
||||
/* HW endpoint contexts are 0-15; convert to epid based on dir */
|
||||
epid = (epid * 2) + (dir_in ? 1 : 0);
|
||||
|
||||
assert(epid >= 1 && epid <= 31);
|
||||
|
||||
dev = hci->dev;
|
||||
xdev = dev->xdev;
|
||||
|
||||
@ -3850,8 +3789,6 @@ pci_xhci_parse_log_level(struct pci_xhci_vdev *xdev, char *opts)
|
||||
char *s, *o;
|
||||
int rc = 0;
|
||||
|
||||
assert(opts);
|
||||
|
||||
o = s = strdup(opts);
|
||||
if (!(s && s[0] == 'l' && s[1] == 'o' && s[2] == 'g')) {
|
||||
rc = -1;
|
||||
@ -3883,9 +3820,6 @@ pci_xhci_parse_bus_port(struct pci_xhci_vdev *xdev, char *opts)
|
||||
struct usb_devpath path;
|
||||
struct usb_native_devinfo di;
|
||||
|
||||
assert(xdev);
|
||||
assert(opts);
|
||||
|
||||
tstr = opts;
|
||||
/* 'bus-port' format */
|
||||
if (!tstr || dm_strtoi(tstr, &tstr, 10, &bus) || *tstr != '-' ||
|
||||
@ -3933,9 +3867,6 @@ pci_xhci_parse_tablet(struct pci_xhci_vdev *xdev, char *opts)
|
||||
uint8_t port_u2, port_u3;
|
||||
int rc = 0;
|
||||
|
||||
assert(xdev);
|
||||
assert(opts);
|
||||
|
||||
if (strncmp(opts, "tablet", sizeof("tablet") - 1)) {
|
||||
rc = -1;
|
||||
goto errout;
|
||||
@ -4013,8 +3944,6 @@ pci_xhci_parse_extcap(struct pci_xhci_vdev *xdev, char *opts)
|
||||
char *s, *o;
|
||||
int rc = 0;
|
||||
|
||||
assert(opts);
|
||||
|
||||
cap = o = s = strdup(opts);
|
||||
|
||||
s = strchr(opts, '=');
|
||||
@ -4057,7 +3986,6 @@ pci_xhci_parse_opts(struct pci_xhci_vdev *xdev, char *opts)
|
||||
int (*f)(struct pci_xhci_vdev *, char *);
|
||||
int elem_cnt;
|
||||
|
||||
assert(xdev);
|
||||
if (!opts) {
|
||||
rc = -1;
|
||||
goto errout;
|
||||
@ -4301,12 +4229,9 @@ pci_xhci_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
struct pci_xhci_vdev *xdev;
|
||||
struct pci_xhci_dev_emu *de;
|
||||
|
||||
assert(dev);
|
||||
xdev = dev->arg;
|
||||
|
||||
UPRINTF(LINF, "de-initialization\r\n");
|
||||
assert(xdev);
|
||||
assert(xdev->devices);
|
||||
|
||||
for (i = 1; i <= XHCI_MAX_DEVS; ++i) {
|
||||
de = xdev->devices[i];
|
||||
|
@ -328,8 +328,6 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer)
|
||||
data = NULL;
|
||||
udata = NULL;
|
||||
|
||||
assert(xfer != NULL && xfer->head >= 0);
|
||||
|
||||
idx = xfer->head;
|
||||
for (i = 0; i < xfer->ndata; i++) {
|
||||
xfer->data[idx].bdone = 0;
|
||||
@ -702,8 +700,6 @@ umouse_data_handler(void *scarg, struct usb_data_xfer *xfer, int dir,
|
||||
int len, i, idx;
|
||||
int err;
|
||||
|
||||
assert(xfer != NULL && xfer->head >= 0);
|
||||
|
||||
UPRINTF(LDBG, "handle data - DIR=%s|EP=%d, blen %d\r\n",
|
||||
dir ? "IN" : "OUT", epctx, xfer->data[0].blen);
|
||||
|
||||
|
@ -83,11 +83,7 @@ internal_scan(struct libusb_device ***list, int list_sz, int depth,
|
||||
struct libusb_device **devlist;
|
||||
struct usb_native_devinfo di;
|
||||
|
||||
assert(visit);
|
||||
assert(list);
|
||||
assert(visit_sz >= list_sz);
|
||||
devlist = *list;
|
||||
|
||||
if (depth >= USB_MAX_TIERS) {
|
||||
UPRINTF(LFTL, "max hub layers(7) reached, stop scan\r\n");
|
||||
return;
|
||||
@ -183,16 +179,11 @@ usb_dev_comp_cb(struct libusb_transfer *trn)
|
||||
uint16_t maxp;
|
||||
uint8_t *buf;
|
||||
|
||||
assert(trn);
|
||||
|
||||
/* async request */
|
||||
r = trn->user_data;
|
||||
assert(r);
|
||||
assert(r->udev);
|
||||
|
||||
/* async transfer */
|
||||
xfer = r->xfer;
|
||||
assert(xfer);
|
||||
|
||||
maxp = usb_dev_get_ep_maxp(r->udev, r->in, xfer->epid / 2);
|
||||
if (trn->type == LIBUSB_TRANSFER_TYPE_ISOCHRONOUS) {
|
||||
@ -268,7 +259,8 @@ usb_dev_comp_cb(struct libusb_transfer *trn)
|
||||
break;
|
||||
|
||||
block = &xfer->data[idx % USB_MAX_XFER_BLOCKS];
|
||||
assert(block->processed);
|
||||
if (block->processed == USB_XFER_BLK_FREE)
|
||||
UPRINTF(LFTL, "error: found free block\r\n");
|
||||
|
||||
d = done;
|
||||
if (d > block->blen)
|
||||
@ -370,7 +362,6 @@ usb_dev_prepare_xfer(struct usb_data_xfer *xfer, int *count, int *size)
|
||||
int found, i, idx, c, s, first;
|
||||
struct usb_data_xfer_block *block = NULL;
|
||||
|
||||
assert(xfer);
|
||||
idx = xfer->head;
|
||||
found = 0;
|
||||
first = -1;
|
||||
@ -433,8 +424,6 @@ usb_dev_err_convert(int err)
|
||||
static inline struct usb_dev_ep *
|
||||
usb_dev_get_ep(struct usb_dev *udev, int pid, int ep)
|
||||
{
|
||||
assert(udev);
|
||||
|
||||
if (ep < 0 || ep >= USB_NUM_ENDPOINT) {
|
||||
UPRINTF(LWRN, "invalid ep %d\r\n", ep);
|
||||
return NULL;
|
||||
@ -516,7 +505,6 @@ usb_dev_update_ep(struct usb_dev *udev)
|
||||
const struct libusb_endpoint_descriptor *desc;
|
||||
int i, j;
|
||||
|
||||
assert(udev);
|
||||
if (libusb_get_active_config_descriptor(udev->info.priv_data, &cfg))
|
||||
return;
|
||||
|
||||
@ -546,10 +534,6 @@ usb_dev_native_toggle_if(struct usb_dev *udev, int claim)
|
||||
uint8_t c, i;
|
||||
int rc = 0, r;
|
||||
|
||||
assert(udev);
|
||||
assert(udev->handle);
|
||||
assert(claim == 1 || claim == 0);
|
||||
|
||||
path = &udev->info.path;
|
||||
r = libusb_get_active_config_descriptor(udev->info.priv_data, &config);
|
||||
if (r) {
|
||||
@ -596,10 +580,6 @@ usb_dev_native_toggle_if_drivers(struct usb_dev *udev, int attach)
|
||||
uint8_t c, i;
|
||||
int rc = 0, r;
|
||||
|
||||
assert(udev);
|
||||
assert(udev->handle);
|
||||
assert(attach == 1 || attach == 0);
|
||||
|
||||
path = &udev->info.path;
|
||||
r = libusb_get_active_config_descriptor(udev->info.priv_data, &config);
|
||||
if (r) {
|
||||
@ -642,9 +622,6 @@ usb_dev_set_config(struct usb_dev *udev, struct usb_data_xfer *xfer, int config)
|
||||
int rc = 0;
|
||||
struct libusb_config_descriptor *cfg;
|
||||
|
||||
assert(udev);
|
||||
assert(udev->handle);
|
||||
|
||||
/*
|
||||
* set configuration
|
||||
* according to the libusb doc, the detach and release work
|
||||
@ -693,10 +670,6 @@ static void
|
||||
usb_dev_set_if(struct usb_dev *udev, int iface, int alt, struct usb_data_xfer
|
||||
*xfer)
|
||||
{
|
||||
assert(udev);
|
||||
assert(xfer);
|
||||
assert(udev->handle);
|
||||
|
||||
if (iface >= USB_NUM_INTERFACE)
|
||||
goto errout;
|
||||
|
||||
@ -757,7 +730,6 @@ usb_dev_reset(void *pdata)
|
||||
struct usb_dev *udev;
|
||||
|
||||
udev = pdata;
|
||||
assert(udev);
|
||||
|
||||
UPRINTF(LDBG, "reset endpoints\n");
|
||||
libusb_reset_device(udev->handle);
|
||||
@ -782,7 +754,6 @@ usb_dev_data(void *pdata, struct usb_data_xfer *xfer, int dir, int epctx)
|
||||
uint16_t maxp;
|
||||
|
||||
udev = pdata;
|
||||
assert(udev);
|
||||
xfer->status = USB_ERR_NORMAL_COMPLETION;
|
||||
|
||||
blk_start = usb_dev_prepare_xfer(xfer, &blk_count, &data_size);
|
||||
@ -934,9 +905,6 @@ usb_dev_request(void *pdata, struct usb_data_xfer *xfer)
|
||||
|
||||
udev = pdata;
|
||||
|
||||
assert(xfer);
|
||||
assert(udev);
|
||||
|
||||
xfer->status = USB_ERR_NORMAL_COMPLETION;
|
||||
if (!udev->info.priv_data || !xfer->ureq) {
|
||||
UPRINTF(LWRN, "invalid request\r\n");
|
||||
@ -1030,7 +998,6 @@ usb_dev_init(void *pdata, char *opt)
|
||||
struct usb_native_devinfo *di;
|
||||
int ver;
|
||||
|
||||
assert(pdata);
|
||||
di = pdata;
|
||||
|
||||
libusb_get_device_descriptor(di->priv_data, &desc);
|
||||
@ -1121,8 +1088,6 @@ usb_dev_info(void *pdata, int type, void *value, int size)
|
||||
void *pv;
|
||||
|
||||
udev = pdata;
|
||||
assert(udev);
|
||||
assert(value);
|
||||
|
||||
switch (type) {
|
||||
case USB_INFO_VERSION:
|
||||
@ -1241,8 +1206,6 @@ usb_dev_sys_init(usb_dev_sys_cb conn_cb, usb_dev_sys_cb disconn_cb,
|
||||
int native_pid, native_vid, native_cls, rc;
|
||||
int num_devs;
|
||||
|
||||
assert(conn_cb);
|
||||
assert(disconn_cb);
|
||||
usb_set_log_level(log_level);
|
||||
|
||||
if (g_ctx.libusb_ctx) {
|
||||
|
Loading…
Reference in New Issue
Block a user