Re: [PATCH 3/5] usb/isp1760: Clean up urb enqueueing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Arvid Brodin wrote:

The review would be easier if you would move the functions. Now diff shows
the removal of one function and the addition of another one.

I don't like the replacement of BUG_ON() with WARN_ON() without changing
code. Here an example:

diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 3a6743d..eca975b 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -379,7 +379,7 @@ static int ehci_reset(struct usb_hcd *hcd)
static void qh_destroy(struct isp1760_qh *qh)
 {
-	BUG_ON(!list_empty(&qh->qtd_list));
+	WARN_ON(!list_empty(&qh->qtd_list));
 	kmem_cache_free(qh_cachep, qh);

You free a qh which has still qtd queued. This means that you have a qh or
qtd pointer stored somewhere. So you don't bug here but later somewhere once that URB completes (unless it is lost).


@@ -1605,7 +1536,7 @@ static int isp1760_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
 	for (i = 0; i < 32; i++) {
 		if (!ints[i].qh)
 			continue;
-		BUG_ON(!ints[i].qtd);
+		WARN_ON(!ints[i].qtd);
if (ints[i].qtd->urb == urb) {
 			u32 skip_map;

Instead of a BUG if there is a NULL pointer where we expect something
valid we get a backtrace (which is also provided by BUG_ON) and we
dereference the NULL pointer.

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux