From: Stefan Roese Date: Thu, 20 Aug 2020 12:22:23 +0200 Subject: [PATCH v2 2/8] usb: xhci: xhci_bulk_tx: Don't "BUG" when comparing addresses In-Reply-To: References: <20200820053543.2801672-1-sr@denx.de> <20200820053543.2801672-3-sr@denx.de> Message-ID: <2639f7ac-ecaa-e75d-bd13-a3ff9d02f2b1@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Bin, On 20.08.20 10:58, Bin Meng wrote: > Hi Stefan, > > On Thu, Aug 20, 2020 at 1:35 PM Stefan Roese wrote: >> >> Octeon uses mapped addresses for virtual and physical memory. Its not > > nits: It's > >> that easy to calculate the resulting addresses here. So lets remove > > let's > >> this BUG_ON() completely, as its not really helpful. > > it's Will change in next version. >> >> Please also note, that BUG_ON() is not recommended any more in the Linux >> kernel. >> >> Signed-off-by: Stefan Roese >> Cc: Bin Meng >> Cc: Marek Vasut >> >> --- >> >> Changes in v2: >> - Completely remove BUG_ON() for this trans_event.buffer check >> - Reword commit text >> >> drivers/usb/host/xhci-ring.c | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c >> index 092ed6eaf1..fd15f39906 100644 >> --- a/drivers/usb/host/xhci-ring.c >> +++ b/drivers/usb/host/xhci-ring.c >> @@ -726,8 +726,6 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe, >> >> BUG_ON(TRB_TO_SLOT_ID(field) != slot_id); >> BUG_ON(TRB_TO_EP_INDEX(field) != ep_index); >> - BUG_ON(*(void **)(uintptr_t)le64_to_cpu(event->trans_event.buffer) - > > Does phys_to_virt() not work on MIPS? It does. But the calculation of the resulting address grew quite frustratingly complex AFAIR (it's been a while, when I created this patch). To sum it up, the resulting expression was unreadable because of the multiple de-references. It seemed "better" to drop this check completely. Especially since Linux (checkpatch) moves away from BUG() statements. I also tried to find this check in the Linux xHCI driver and failed. Thanks, Stefan