usb: musb-new: Drop use of BUG()
diff mbox series

Message ID 20191208165714.1.I612ef46166caaad0422784ae7f207ba7d9b56886@changeid
State Superseded
Delegated to: Marek Vasut
Headers show
Series
  • usb: musb-new: Drop use of BUG()
Related show

Commit Message

Simon Glass Dec. 8, 2019, 11:57 p.m. UTC
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@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(-)

Patch
diff mbox series

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;