In a test where some memory corruption happened, I noticed an
oops (null pointer exception in_irq) that's avoidable. Here's
a patch that avoids it ... anyone seeing the err() is likely
to hang some process, but that's better than the alternative.
(Also inlines some used-once routines, saving a bit of space
to make up for the new diagnostic.)
Please merge to Linus' latest.
- dave
--- ./drivers/usb-dist/host/ohci-q.c Fri Sep 27 17:35:32 2002
+++ ./drivers/usb/host/ohci-q.c Sun Sep 29 08:04:55 2002
@@ -855,4 +855,9 @@
td = dma_to_td (ohci, td_dma);
+ if (!td) {
+ err ("%s bad entry %8x",
+ ohci->hcd.self.bus_name, td_dma);
+ break;
+ }
td->hwINFO |= cpu_to_le32 (TD_DONE);
--- ./drivers/usb-dist/host/ohci-mem.c Sun Sep 15 19:57:44 2002
+++ ./drivers/usb/host/ohci-mem.c Sun Sep 29 10:27:24 2002
@@ -49,8 +49,8 @@
while (scan && scan->dma != dma)
scan = scan->next;
- return scan->virt;
+ return scan ? scan->virt : 0;
}
-static struct td *
+static inline struct td *
dma_to_td (struct ohci_hcd *hc, dma_addr_t td_dma)
{
@@ -63,5 +63,5 @@
/* Add a hash entry for a TD/ED; return true on success */
-static int
+static inline int
hash_add_ed_td (
struct hash_list_t *entry,
@@ -98,5 +98,5 @@
-static void
+static inline void
hash_free_ed_td (struct hash_list_t *entry, void *virt)
{