xhci-mem.c: xhci_segment_free: No need for checking seg argument
[pandora-kernel.git] / drivers / usb / host / xhci-mem.c
index 94a8b28..bc6ec0c 100644 (file)
@@ -61,8 +61,6 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci, gfp_t flag
 
 static void xhci_segment_free(struct xhci_hcd *xhci, struct xhci_segment *seg)
 {
-       if (!seg)
-               return;
        if (seg->trbs) {
                xhci_dbg(xhci, "Freeing DMA segment at %p (virtual) 0x%llx (DMA)\n",
                                seg->trbs, (unsigned long long)seg->dma);
@@ -112,18 +110,20 @@ void xhci_ring_free(struct xhci_hcd *xhci, struct xhci_ring *ring)
        struct xhci_segment *seg;
        struct xhci_segment *first_seg;
 
-       if (!ring || !ring->first_seg)
+       if (!ring)
                return;
-       first_seg = ring->first_seg;
-       seg = first_seg->next;
-       xhci_dbg(xhci, "Freeing ring at %p\n", ring);
-       while (seg != first_seg) {
-               struct xhci_segment *next = seg->next;
-               xhci_segment_free(xhci, seg);
-               seg = next;
+       if (ring->first_seg) {
+               first_seg = ring->first_seg;
+               seg = first_seg->next;
+               xhci_dbg(xhci, "Freeing ring at %p\n", ring);
+               while (seg != first_seg) {
+                       struct xhci_segment *next = seg->next;
+                       xhci_segment_free(xhci, seg);
+                       seg = next;
+               }
+               xhci_segment_free(xhci, first_seg);
+               ring->first_seg = NULL;
        }
-       xhci_segment_free(xhci, first_seg);
-       ring->first_seg = NULL;
        kfree(ring);
 }