]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: Drop use of BUG_ON() and WARN_ON()
authorSimon Glass <sjg@chromium.org>
Mon, 30 Dec 2019 04:19:12 +0000 (21:19 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 7 Jan 2020 23:02:38 +0000 (16:02 -0700)
These macros use __FILE__ which inserts the full path of the object file
into U-Boot, thus increasing file size. Drop these usages.

An older version of this patch was submitted here:

http://patchwork.ozlabs.org/patch/1205784/

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/usb/gadget/composite.c
drivers/usb/gadget/f_mass_storage.c
drivers/usb/musb-new/musb_core.c
drivers/usb/musb-new/musb_gadget_ep0.c

index c98a444245c28b6d77495e5fabfce07f481160c1..4a6f4271d5bf61c84eba29a07ffe744dba6b21ff 100644 (file)
@@ -1003,7 +1003,11 @@ static void composite_unbind(struct usb_gadget *gadget)
         * so there's no i/o concurrency that could affect the
         * state protected by cdev->lock.
         */
+#ifdef __UBOOT__
+       assert_noisy(!cdev->config);
+#else
        BUG_ON(cdev->config);
+#endif
 
        while (!list_empty(&cdev->configs)) {
                c = list_first_entry(&cdev->configs,
index 45c7b58eed43f4cd385a790dc20c7935340437b9..c1e6506659cc9c65ceb9161e302832aaff0be41f 100644 (file)
@@ -390,7 +390,11 @@ static inline int __fsg_is_set(struct fsg_common *common,
        if (common->fsg)
                return 1;
        ERROR(common, "common->fsg is NULL in %s at %u\n", func, line);
+#ifdef __UBOOT__
+       assert_noisy(false);
+#else
        WARN_ON(1);
+#endif
        return 0;
 }
 
index afea9fbcef67205cab4306ff3df4b1002b28d2d8..ab5e3aa9d13a3e9c120cd7dfa3fa6eb79e85528d 100644 (file)
@@ -1859,7 +1859,11 @@ allocate_instance(struct device *dev,
        musb->ctrl_base = mbase;
        musb->nIrq = -ENODEV;
        musb->config = config;
+#ifdef __UBOOT__
+       assert_noisy(musb->config->num_eps <= MUSB_C_NUM_EPS);
+#else
        BUG_ON(musb->config->num_eps > MUSB_C_NUM_EPS);
+#endif
        for (epnum = 0, ep = musb->endpoints;
                        epnum < musb->config->num_eps;
                        epnum++, ep++) {
index 9835a2e2bf75f127d38c1f4092c63814fcf4d27e..3ef8fe13732d26220017a5df7047ac5f63e0d1f1 100644 (file)
@@ -882,7 +882,7 @@ finish:
 
        default:
                /* "can't happen" */
-               WARN_ON(1);
+               assert_noisy(false);
                musb_writew(regs, MUSB_CSR0, MUSB_CSR0_P_SENDSTALL);
                musb->ep0_state = MUSB_EP0_STAGE_IDLE;
                break;