[PATCH] usb: musb-new: Drop use of BUG()
Simon Glass
sjg at chromium.org
Mon Dec 9 00:57:17 CET 2019
These macros use __FILE__ which inserts the full path of the object file
into U-Boot, thus increasing file size. Drop these usages.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
drivers/usb/musb-new/musb_core.c | 6 ++++++
drivers/usb/musb-new/musb_gadget_ep0.c | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index afea9fbcef..238e4708a5 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -1859,7 +1859,13 @@ allocate_instance(struct device *dev,
musb->ctrl_base = mbase;
musb->nIrq = -ENODEV;
musb->config = config;
+#ifdef __UBOOT__
+ assert(musb->config->num_eps <= MUSB_C_NUM_EPS);
+ if (musb->config->num_eps > MUSB_C_NUM_EPS)
+ return NULL;
+#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++) {
diff --git a/drivers/usb/musb-new/musb_gadget_ep0.c b/drivers/usb/musb-new/musb_gadget_ep0.c
index 9835a2e2bf..3adabcb69f 100644
--- a/drivers/usb/musb-new/musb_gadget_ep0.c
+++ b/drivers/usb/musb-new/musb_gadget_ep0.c
@@ -882,7 +882,9 @@ finish:
default:
/* "can't happen" */
- WARN_ON(1);
+ /* WARN_ON(1); (disable since __FILE__ can be large) */
+ dev_dbg(musb->controller, "odd; unknown state %d\n",
+ musb->ep0_state);
musb_writew(regs, MUSB_CSR0, MUSB_CSR0_P_SENDSTALL);
musb->ep0_state = MUSB_EP0_STAGE_IDLE;
break;
--
2.24.0.393.g34dc348eaf-goog
More information about the U-Boot
mailing list