usb: gadget: fix unused-but-set-variale warnings
authorMichal Nazarewicz <mina86@mina86.com>
Tue, 31 May 2016 12:17:21 +0000 (14:17 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 21 Jun 2016 08:04:09 +0000 (11:04 +0300)
Those are enabled with W=1 make option.

The patch leaves of some type-limits warnings which are caused by
generic macros used in a way where they produce always-false
conditions.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_fs.c
drivers/usb/gadget/function/u_serial.c
drivers/usb/gadget/legacy/g_ffs.c
drivers/usb/gadget/udc/amd5536udc.c
drivers/usb/gadget/udc/bdc/bdc_cmd.c
drivers/usb/gadget/udc/bdc/bdc_ep.c
drivers/usb/gadget/udc/dummy_hcd.c
drivers/usb/gadget/udc/mv_udc_core.c
drivers/usb/gadget/udc/net2272.c
drivers/usb/gadget/udc/pch_udc.c
drivers/usb/gadget/udc/udc-xilinx.c

index cc33d26..70ed370 100644 (file)
@@ -2227,8 +2227,8 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
 {
        u32 str_count, needed_count, lang_count;
        struct usb_gadget_strings **stringtabs, *t;
-       struct usb_string *strings, *s;
        const char *data = _data;
+       struct usb_string *s;
 
        ENTER();
 
@@ -2286,7 +2286,6 @@ static int __ffs_data_got_strings(struct ffs_data *ffs,
                stringtabs = vla_ptr(vlabuf, d, stringtabs);
                t = vla_ptr(vlabuf, d, stringtab);
                s = vla_ptr(vlabuf, d, strings);
-               strings = s;
        }
 
        /* For each language */
index 3580f19..6ded634 100644 (file)
@@ -907,7 +907,6 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count)
 {
        struct gs_port  *port = tty->driver_data;
        unsigned long   flags;
-       int             status;
 
        pr_vdebug("gs_write: ttyGS%d (%p) writing %d bytes\n",
                        port->port_num, tty, count);
@@ -917,7 +916,7 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count)
                count = gs_buf_put(&port->port_write_buf, buf, count);
        /* treat count == 0 as flush_chars() */
        if (port->port_usb)
-               status = gs_start_tx(port);
+               gs_start_tx(port);
        spin_unlock_irqrestore(&port->port_lock, flags);
 
        return count;
index f85639e..6da7316 100644 (file)
@@ -265,7 +265,7 @@ static void *functionfs_acquire_dev(struct ffs_dev *dev)
 {
        if (!try_module_get(THIS_MODULE))
                return ERR_PTR(-ENOENT);
-       
+
        return NULL;
 }
 
@@ -275,7 +275,7 @@ static void functionfs_release_dev(struct ffs_dev *dev)
 }
 
 /*
- * The caller of this function takes ffs_lock 
+ * The caller of this function takes ffs_lock
  */
 static int functionfs_ready_callback(struct ffs_data *ffs)
 {
@@ -294,12 +294,12 @@ static int functionfs_ready_callback(struct ffs_data *ffs)
                ++missing_funcs;
                gfs_registered = false;
        }
-       
+
        return ret;
 }
 
 /*
- * The caller of this function takes ffs_lock 
+ * The caller of this function takes ffs_lock
  */
 static void functionfs_closed_callback(struct ffs_data *ffs)
 {
@@ -347,17 +347,14 @@ static int gfs_bind(struct usb_composite_dev *cdev)
 
 #ifdef CONFIG_USB_FUNCTIONFS_RNDIS
        {
-               struct f_rndis_opts *rndis_opts;
-
                fi_rndis = usb_get_function_instance("rndis");
                if (IS_ERR(fi_rndis)) {
                        ret = PTR_ERR(fi_rndis);
                        goto error;
                }
-               rndis_opts = container_of(fi_rndis, struct f_rndis_opts,
-                                         func_inst);
 #ifndef CONFIG_USB_FUNCTIONFS_ETH
-               net = rndis_opts->net;
+               net = container_of(fi_rndis, struct f_rndis_opts,
+                                  func_inst)->net;
 #endif
        }
 #endif
index 39d70b4..ea03ca7 100644 (file)
@@ -2340,7 +2340,6 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix)
        struct udc_ep *ep;
        struct udc_request *req;
        struct udc_data_dma *td;
-       unsigned dma_done;
        unsigned len;
 
        ep = &dev->ep[ep_ix];
@@ -2385,13 +2384,8 @@ static irqreturn_t udc_data_in_isr(struct udc *dev, int ep_ix)
                         */
                        if (use_dma_ppb_du) {
                                td = udc_get_last_dma_desc(req);
-                               if (td) {
-                                       dma_done =
-                                               AMD_GETBITS(td->status,
-                                               UDC_DMA_IN_STS_BS);
-                                       /* don't care DMA done */
+                               if (td)
                                        req->req.actual = req->req.length;
-                               }
                        } else {
                                /* assume all bytes transferred */
                                req->req.actual = req->req.length;
@@ -3417,4 +3411,3 @@ module_pci_driver(udc_pci_driver);
 MODULE_DESCRIPTION(UDC_MOD_DESCRIPTION);
 MODULE_AUTHOR("Thomas Dahlmann");
 MODULE_LICENSE("GPL");
-
index 6a4155c..4d5e918 100644 (file)
@@ -57,7 +57,6 @@ static int bdc_submit_cmd(struct bdc *bdc, u32 cmd_sc,
                                        u32 param0, u32 param1, u32 param2)
 {
        u32 temp, cmd_status;
-       int reset_bdc = 0;
        int ret;
 
        temp = bdc_readl(bdc->regs, BDC_CMDSC);
@@ -94,7 +93,6 @@ static int bdc_submit_cmd(struct bdc *bdc, u32 cmd_sc,
 
        case BDC_CMDS_INTL:
                dev_err(bdc->dev, "BDC Internal error\n");
-               reset_bdc = 1;
                ret = -ECONNRESET;
                break;
 
@@ -102,7 +100,6 @@ static int bdc_submit_cmd(struct bdc *bdc, u32 cmd_sc,
                dev_err(bdc->dev,
                        "command timedout waited for %dusec\n",
                        BDC_CMD_TIMEOUT);
-               reset_bdc = 1;
                ret = -ECONNRESET;
                break;
        default:
index d619950..650717e 100644 (file)
@@ -702,11 +702,9 @@ static int ep0_queue(struct bdc_ep *ep, struct bdc_req *req)
 /* Queue data stage */
 static int ep0_queue_data_stage(struct bdc *bdc)
 {
-       struct usb_request *ep0_usb_req;
        struct bdc_ep *ep;
 
        dev_dbg(bdc->dev, "%s\n", __func__);
-       ep0_usb_req = &bdc->ep0_req.usb_req;
        ep = bdc->bdc_ep_array[1];
        bdc->ep0_req.ep = ep;
        bdc->ep0_req.usb_req.complete = NULL;
@@ -1393,10 +1391,8 @@ static int ep0_set_sel(struct bdc *bdc,
 {
        struct bdc_ep   *ep;
        u16     wLength;
-       u16     wValue;
 
        dev_dbg(bdc->dev, "%s\n", __func__);
-       wValue = le16_to_cpu(setup_pkt->wValue);
        wLength = le16_to_cpu(setup_pkt->wLength);
        if (unlikely(wLength != 6)) {
                dev_err(bdc->dev, "%s Wrong wLength:%d\n", __func__, wLength);
index dde4445..77d0790 100644 (file)
@@ -647,12 +647,10 @@ static int dummy_disable(struct usb_ep *_ep)
 static struct usb_request *dummy_alloc_request(struct usb_ep *_ep,
                gfp_t mem_flags)
 {
-       struct dummy_ep         *ep;
        struct dummy_request    *req;
 
        if (!_ep)
                return NULL;
-       ep = usb_ep_to_dummy_ep(_ep);
 
        req = kzalloc(sizeof(*req), mem_flags);
        if (!req)
@@ -2444,9 +2442,6 @@ static int dummy_start(struct usb_hcd *hcd)
 
 static void dummy_stop(struct usb_hcd *hcd)
 {
-       struct dummy            *dum;
-
-       dum = hcd_to_dummy_hcd(hcd)->dum;
        device_remove_file(dummy_dev(hcd_to_dummy_hcd(hcd)), &dev_attr_urbs);
        dev_info(dummy_dev(hcd_to_dummy_hcd(hcd)), "stopped\n");
 }
index 81b6229..ce73b35 100644 (file)
@@ -129,7 +129,7 @@ static int process_ep_req(struct mv_udc *udc, int index,
 {
        struct mv_dtd   *curr_dtd;
        struct mv_dqh   *curr_dqh;
-       int td_complete, actual, remaining_length;
+       int actual, remaining_length;
        int i, direction;
        int retval = 0;
        u32 errors;
@@ -139,7 +139,6 @@ static int process_ep_req(struct mv_udc *udc, int index,
        direction = index % 2;
 
        curr_dtd = curr_req->head;
-       td_complete = 0;
        actual = curr_req->req.length;
 
        for (i = 0; i < curr_req->dtd_count; i++) {
@@ -412,11 +411,8 @@ static int req_to_dtd(struct mv_req *req)
        unsigned count;
        int is_last, is_first = 1;
        struct mv_dtd *dtd, *last_dtd = NULL;
-       struct mv_udc *udc;
        dma_addr_t dma;
 
-       udc = req->ep->udc;
-
        do {
                dtd = build_dtd(req, &count, &dma, &is_last);
                if (dtd == NULL)
@@ -567,7 +563,7 @@ static int  mv_ep_disable(struct usb_ep *_ep)
        struct mv_udc *udc;
        struct mv_ep *ep;
        struct mv_dqh *dqh;
-       u32 bit_pos, epctrlx, direction;
+       u32 epctrlx, direction;
        unsigned long flags;
 
        ep = container_of(_ep, struct mv_ep, ep);
@@ -582,7 +578,6 @@ static int  mv_ep_disable(struct usb_ep *_ep)
        spin_lock_irqsave(&udc->lock, flags);
 
        direction = ep_dir(ep);
-       bit_pos = 1 << ((direction == EP_DIR_OUT ? 0 : 16) + ep->ep_num);
 
        /* Reset the max packet length and the interrupt on Setup */
        dqh->max_packet_length = 0;
index 18f5ebd..7c61134 100644 (file)
@@ -329,12 +329,10 @@ static int net2272_disable(struct usb_ep *_ep)
 static struct usb_request *
 net2272_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
 {
-       struct net2272_ep *ep;
        struct net2272_request *req;
 
        if (!_ep)
                return NULL;
-       ep = container_of(_ep, struct net2272_ep, ep);
 
        req = kzalloc(sizeof(*req), gfp_flags);
        if (!req)
@@ -348,10 +346,8 @@ net2272_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags)
 static void
 net2272_free_request(struct usb_ep *_ep, struct usb_request *_req)
 {
-       struct net2272_ep *ep;
        struct net2272_request *req;
 
-       ep = container_of(_ep, struct net2272_ep, ep);
        if (!_ep || !_req)
                return;
 
index ebc51ec..8ad847a 100644 (file)
@@ -1984,9 +1984,8 @@ static int pch_udc_pcd_set_halt(struct usb_ep *usbep, int halt)
                        if (ep->num == PCH_UDC_EP0)
                                ep->dev->stall = 1;
                        pch_udc_ep_set_stall(ep);
-                       pch_udc_enable_ep_interrupts(ep->dev,
-                                                    PCH_UDC_EPINT(ep->in,
-                                                                  ep->num));
+                       pch_udc_enable_ep_interrupts(
+                               ep->dev, PCH_UDC_EPINT(ep->in, ep->num));
                } else {
                        pch_udc_ep_clear_stall(ep);
                }
@@ -2451,16 +2450,11 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev)
  */
 static void pch_udc_postsvc_epinters(struct pch_udc_dev *dev, int ep_num)
 {
-       struct pch_udc_ep       *ep;
-       struct pch_udc_request *req;
-
-       ep = &dev->ep[UDC_EPIN_IDX(ep_num)];
-       if (!list_empty(&ep->queue)) {
-               req = list_entry(ep->queue.next, struct pch_udc_request, queue);
-               pch_udc_enable_ep_interrupts(ep->dev,
-                                            PCH_UDC_EPINT(ep->in, ep->num));
-               pch_udc_ep_clear_nak(ep);
-       }
+       struct pch_udc_ep       *ep = &dev->ep[UDC_EPIN_IDX(ep_num)];
+       if (list_empty(&ep->queue))
+               return;
+       pch_udc_enable_ep_interrupts(ep->dev, PCH_UDC_EPINT(ep->in, ep->num));
+       pch_udc_ep_clear_nak(ep);
 }
 
 /**
index 1cbb0ac..f8bf290 100644 (file)
@@ -2055,7 +2055,6 @@ static int xudc_probe(struct platform_device *pdev)
        struct device_node *np = pdev->dev.of_node;
        struct resource *res;
        struct xusb_udc *udc;
-       struct xusb_ep *ep0;
        int irq;
        int ret;
        u32 ier;
@@ -2119,8 +2118,6 @@ static int xudc_probe(struct platform_device *pdev)
 
        xudc_eps_init(udc);
 
-       ep0 = &udc->ep[0];
-
        /* Set device address to 0.*/
        udc->write_fn(udc->addr, XUSB_ADDRESS_OFFSET, 0);