usb: musb: Fix bad call to kfree() in musb_free
authorBrian Downing <bdowning@lavos.net>
Sat, 4 Aug 2012 23:32:19 +0000 (18:32 -0500)
committerFelipe Balbi <balbi@ti.com>
Tue, 7 Aug 2012 11:26:17 +0000 (14:26 +0300)
Commit 622859634a663c5e55d0e2a2cdbb55ac058d97b3 (usb: musb: drop a
gigantic amount of ifdeferry) included this change:

    @@ -1901,11 +1844,7 @@ static void musb_free(struct musb *musb)
                    dma_controller_destroy(c);
            }

    -#ifdef CONFIG_USB_MUSB_HDRC_HCD
    -       usb_put_hcd(musb_to_hcd(musb));
    -#else
            kfree(musb);
    -#endif
     }

     /*

Since musb comes from struct usb_hcd's hcd_priv, which is allocated on
the end of that struct, kfree'ing it is not going to work.  Replace
kfree(musb) with usb_put_hcd(musb_to_hcd(musb)), which appears to be
the right thing to do here.

Signed-off-by: Brian Downing <bdowning@lavos.net>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/musb/musb_core.c

index 9bc4feab4fe03f6e9ffe9aa32900fa9b444f82d0..65b3f5310922508b50658b7129fee6239a63e904 100644 (file)
@@ -1868,7 +1868,7 @@ static void musb_free(struct musb *musb)
                dma_controller_destroy(c);
        }
 
-       kfree(musb);
+       usb_put_hcd(musb_to_hcd(musb));
 }
 
 /*