| .. | .. |
|---|
| 53 | 53 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) |
|---|
| 54 | 54 | |
|---|
| 55 | 55 | static const char driver_name[] = "fsl-usb2-udc"; |
|---|
| 56 | | -static const char driver_desc[] = DRIVER_DESC; |
|---|
| 57 | 56 | |
|---|
| 58 | 57 | static struct usb_dr_device __iomem *dr_regs; |
|---|
| 59 | 58 | |
|---|
| .. | .. |
|---|
| 251 | 250 | break; |
|---|
| 252 | 251 | case FSL_USB2_PHY_UTMI_WIDE: |
|---|
| 253 | 252 | portctrl |= PORTSCX_PTW_16BIT; |
|---|
| 254 | | - /* fall through */ |
|---|
| 253 | + fallthrough; |
|---|
| 255 | 254 | case FSL_USB2_PHY_UTMI: |
|---|
| 256 | 255 | case FSL_USB2_PHY_UTMI_DUAL: |
|---|
| 257 | 256 | if (udc->pdata->have_sysif_regs) { |
|---|
| .. | .. |
|---|
| 1052 | 1051 | u32 bitmask; |
|---|
| 1053 | 1052 | struct ep_queue_head *qh; |
|---|
| 1054 | 1053 | |
|---|
| 1055 | | - ep = container_of(_ep, struct fsl_ep, ep); |
|---|
| 1056 | | - if (!_ep || (!ep->ep.desc && ep_index(ep) != 0)) |
|---|
| 1054 | + if (!_ep || !_ep->desc || !(_ep->desc->bEndpointAddress&0xF)) |
|---|
| 1057 | 1055 | return -ENODEV; |
|---|
| 1056 | + |
|---|
| 1057 | + ep = container_of(_ep, struct fsl_ep, ep); |
|---|
| 1058 | 1058 | |
|---|
| 1059 | 1059 | udc = (struct fsl_udc *)ep->udc; |
|---|
| 1060 | 1060 | |
|---|
| .. | .. |
|---|
| 1208 | 1208 | } |
|---|
| 1209 | 1209 | |
|---|
| 1210 | 1210 | /* Change Data+ pullup status |
|---|
| 1211 | | - * this func is used by usb_gadget_connect/disconnet |
|---|
| 1211 | + * this func is used by usb_gadget_connect/disconnect |
|---|
| 1212 | 1212 | */ |
|---|
| 1213 | 1213 | static int fsl_pullup(struct usb_gadget *gadget, int is_on) |
|---|
| 1214 | 1214 | { |
|---|
| .. | .. |
|---|
| 1595 | 1595 | struct fsl_req *curr_req) |
|---|
| 1596 | 1596 | { |
|---|
| 1597 | 1597 | struct ep_td_struct *curr_td; |
|---|
| 1598 | | - int td_complete, actual, remaining_length, j, tmp; |
|---|
| 1598 | + int actual, remaining_length, j, tmp; |
|---|
| 1599 | 1599 | int status = 0; |
|---|
| 1600 | 1600 | int errors = 0; |
|---|
| 1601 | 1601 | struct ep_queue_head *curr_qh = &udc->ep_qh[pipe]; |
|---|
| 1602 | 1602 | int direction = pipe % 2; |
|---|
| 1603 | 1603 | |
|---|
| 1604 | 1604 | curr_td = curr_req->head; |
|---|
| 1605 | | - td_complete = 0; |
|---|
| 1606 | 1605 | actual = curr_req->req.length; |
|---|
| 1607 | 1606 | |
|---|
| 1608 | 1607 | for (j = 0; j < curr_req->dtd_count; j++) { |
|---|
| .. | .. |
|---|
| 1647 | 1646 | status = -EPROTO; |
|---|
| 1648 | 1647 | break; |
|---|
| 1649 | 1648 | } else { |
|---|
| 1650 | | - td_complete++; |
|---|
| 1651 | 1649 | break; |
|---|
| 1652 | 1650 | } |
|---|
| 1653 | 1651 | } else { |
|---|
| 1654 | | - td_complete++; |
|---|
| 1655 | 1652 | VDBG("dTD transmitted successful"); |
|---|
| 1656 | 1653 | } |
|---|
| 1657 | 1654 | |
|---|
| .. | .. |
|---|
| 2064 | 2061 | "Sleep Enable: %d SOF Received Enable: %d " |
|---|
| 2065 | 2062 | "Reset Enable: %d\n" |
|---|
| 2066 | 2063 | "System Error Enable: %d " |
|---|
| 2067 | | - "Port Change Dectected Enable: %d\n" |
|---|
| 2064 | + "Port Change Detected Enable: %d\n" |
|---|
| 2068 | 2065 | "USB Error Intr Enable: %d USB Intr Enable: %d\n\n", |
|---|
| 2069 | 2066 | (tmp_reg & USB_INTR_DEVICE_SUSPEND) ? 1 : 0, |
|---|
| 2070 | 2067 | (tmp_reg & USB_INTR_SOF_EN) ? 1 : 0, |
|---|
| .. | .. |
|---|
| 2234 | 2231 | Internal structure setup functions |
|---|
| 2235 | 2232 | *******************************************************************/ |
|---|
| 2236 | 2233 | /*------------------------------------------------------------------ |
|---|
| 2237 | | - * init resource for globle controller |
|---|
| 2238 | | - * Return the udc handle on success or NULL on failure |
|---|
| 2234 | + * init resource for global controller called by fsl_udc_probe() |
|---|
| 2235 | + * On success the udc handle is initialized, on failure it is |
|---|
| 2236 | + * unchanged (reset). |
|---|
| 2237 | + * Return 0 on success and -1 on allocation failure |
|---|
| 2239 | 2238 | ------------------------------------------------------------------*/ |
|---|
| 2240 | 2239 | static int struct_udc_setup(struct fsl_udc *udc, |
|---|
| 2241 | 2240 | struct platform_device *pdev) |
|---|
| .. | .. |
|---|
| 2440 | 2439 | /* DEN is bidirectional ep number, max_ep doubles the number */ |
|---|
| 2441 | 2440 | udc_controller->max_ep = (dccparams & DCCPARAMS_DEN_MASK) * 2; |
|---|
| 2442 | 2441 | |
|---|
| 2443 | | - udc_controller->irq = platform_get_irq(pdev, 0); |
|---|
| 2444 | | - if (!udc_controller->irq) { |
|---|
| 2445 | | - ret = -ENODEV; |
|---|
| 2442 | + ret = platform_get_irq(pdev, 0); |
|---|
| 2443 | + if (ret <= 0) { |
|---|
| 2444 | + ret = ret ? : -ENODEV; |
|---|
| 2446 | 2445 | goto err_iounmap; |
|---|
| 2447 | 2446 | } |
|---|
| 2447 | + udc_controller->irq = ret; |
|---|
| 2448 | 2448 | |
|---|
| 2449 | 2449 | ret = request_irq(udc_controller->irq, fsl_udc_irq, IRQF_SHARED, |
|---|
| 2450 | 2450 | driver_name, udc_controller); |
|---|