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.)
struct hash_t * scan = entry->head;
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)
{
td_dma &= TD_MASK;
// FIXME: when updating the hashtables this way, mem_flags is unusable...
/* 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,
void *virt,
}
-static void
+static inline void
hash_free_ed_td (struct hash_list_t *entry, void *virt)
{
struct hash_t *scan, *prev;
int cc;
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);
cc = TD_CC_GET (le32_to_cpup (&td->hwINFO));