If the probe fails, udc_remove() will not be called, so there is no
reason to make del_timer_sync() calls conditional. As a result, use of
the .data field can be dropped, in support of making removing this field
entirely from struct timer_list.

Cc: Felipe Balbi <ba...@kernel.org>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: Raviteja Garimella <raviteja.garime...@broadcom.com>
Cc: Michal Nazarewicz <min...@mina86.com>
Cc: "Gustavo A. R. Silva" <garsi...@embeddedor.com>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Kees Cook <keesc...@chromium.org>
---
 drivers/usb/gadget/udc/snps_udc_core.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/udc/snps_udc_core.c 
b/drivers/usb/gadget/udc/snps_udc_core.c
index 5460e5ba1c3c..e05bdc16e1e3 100644
--- a/drivers/usb/gadget/udc/snps_udc_core.c
+++ b/drivers/usb/gadget/udc/snps_udc_core.c
@@ -3067,14 +3067,12 @@ void udc_remove(struct udc *dev)
        stop_timer++;
        if (timer_pending(&udc_timer))
                wait_for_completion(&on_exit);
-       if (udc_timer.data)
-               del_timer_sync(&udc_timer);
+       del_timer_sync(&udc_timer);
        /* remove pollstall timer */
        stop_pollstall_timer++;
        if (timer_pending(&udc_pollstall_timer))
                wait_for_completion(&on_pollstall_exit);
-       if (udc_pollstall_timer.data)
-               del_timer_sync(&udc_pollstall_timer);
+       del_timer_sync(&udc_pollstall_timer);
        udc = NULL;
 }
 EXPORT_SYMBOL_GPL(udc_remove);
@@ -3164,10 +3162,6 @@ int udc_probe(struct udc *dev)
        u32             reg;
        int             retval;
 
-       /* mark timer as not initialized */
-       udc_timer.data = 0;
-       udc_pollstall_timer.data = 0;
-
        /* device struct setup */
        dev->gadget.ops = &udc_ops;
 
@@ -3207,8 +3201,8 @@ int udc_probe(struct udc *dev)
                goto finished;
 
        /* timer init */
-       setup_timer(&udc_timer, udc_timer_function, 1);
-       setup_timer(&udc_pollstall_timer, udc_pollstall_timer_function, 1);
+       setup_timer(&udc_timer, udc_timer_function, 0);
+       setup_timer(&udc_pollstall_timer, udc_pollstall_timer_function, 0);
 
        /* set SD */
        reg = readl(&dev->regs->ctl);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to