[PATCH v2] musb: Fix bad call to kfree() in musb_free

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

 



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@xxxxxxxxx>
---
    With wording change requested by Sergei.  Thanks!

 drivers/usb/musb/musb_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 26f1bef..cac54f7 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1862,7 +1862,7 @@ static void musb_free(struct musb *musb)
 		dma_controller_destroy(c);
 	}
 
-	kfree(musb);
+	usb_put_hcd(musb_to_hcd(musb));
 }
 
 /*
-- 
1.7.11.4

--
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