diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2010-09-29 02:54:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:21:58 -0400 |
commit | f405387435a85a440d1ce16f3ca36e042281643a (patch) | |
tree | a92a1723beca4c3bc350f1c9e3843c98eaf0a9ce /drivers | |
parent | 230f7ede6c2f0e403f29e03e0251a470aa9350dd (diff) |
USB: MUSB: fix kernel WARNING/oops when unloading module in OTG mode
Since commit 461972d8a4c94bc44f11a13046041c78a7cf18dd (musb_core: don't call
musb_platform_exit() twice), unloading the driver module results in a WARNING
"kobject: '(null)' (c73de788): is not initialized, yet kobject_put() is being
called." (or even kernel oops) on e.g. DaVincis, though only in the OTG mode.
There exists dubious and unbalanced put_device() call in musb_free() which
takes place only in the OTG mode. As this commit caused musb_platform_exit()
to be called (and so unregister the NOP transceiver) before this put_device()
call, this function references already freed memory.
On the other hand, all the glue layers miss the otg_put_transceiver() call,
complementary to the otg_get_transceiver() call that they do. So, I think
the solution is to get rid of the strange put_device() call, and instead
call otg_put_transceiver() in the glue layers...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/musb/blackfin.c | 1 | ||||
-rw-r--r-- | drivers/usb/musb/davinci.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.c | 4 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.c | 1 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 4 |
5 files changed, 8 insertions, 4 deletions
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index b611420a8050..9733fe9b597a 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -397,5 +397,6 @@ int musb_platform_exit(struct musb *musb) | |||
397 | 397 | ||
398 | gpio_free(musb->config->gpio_vrsel); | 398 | gpio_free(musb->config->gpio_vrsel); |
399 | 399 | ||
400 | otg_put_transceiver(musb->xceiv); | ||
400 | return 0; | 401 | return 0; |
401 | } | 402 | } |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 57624361c1de..6e67629f50cc 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -446,6 +446,7 @@ int __init musb_platform_init(struct musb *musb, void *board_data) | |||
446 | fail: | 446 | fail: |
447 | clk_disable(musb->clock); | 447 | clk_disable(musb->clock); |
448 | 448 | ||
449 | otg_put_transceiver(musb->xceiv); | ||
449 | usb_nop_xceiv_unregister(); | 450 | usb_nop_xceiv_unregister(); |
450 | return -ENODEV; | 451 | return -ENODEV; |
451 | } | 452 | } |
@@ -496,6 +497,7 @@ int musb_platform_exit(struct musb *musb) | |||
496 | 497 | ||
497 | clk_disable(musb->clock); | 498 | clk_disable(musb->clock); |
498 | 499 | ||
500 | otg_put_transceiver(musb->xceiv); | ||
499 | usb_nop_xceiv_unregister(); | 501 | usb_nop_xceiv_unregister(); |
500 | 502 | ||
501 | return 0; | 503 | return 0; |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 472b2a7e7896..7e2c353755d2 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1926,10 +1926,6 @@ static void musb_free(struct musb *musb) | |||
1926 | dma_controller_destroy(c); | 1926 | dma_controller_destroy(c); |
1927 | } | 1927 | } |
1928 | 1928 | ||
1929 | #ifdef CONFIG_USB_MUSB_OTG | ||
1930 | put_device(musb->xceiv->dev); | ||
1931 | #endif | ||
1932 | |||
1933 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | 1929 | #ifdef CONFIG_USB_MUSB_HDRC_HCD |
1934 | usb_put_hcd(musb_to_hcd(musb)); | 1930 | usb_put_hcd(musb_to_hcd(musb)); |
1935 | #else | 1931 | #else |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 2111a241dd03..ed618bde1eec 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -320,5 +320,6 @@ int musb_platform_exit(struct musb *musb) | |||
320 | 320 | ||
321 | musb_platform_suspend(musb); | 321 | musb_platform_suspend(musb); |
322 | 322 | ||
323 | otg_put_transceiver(musb->xceiv); | ||
323 | return 0; | 324 | return 0; |
324 | } | 325 | } |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 3c48e77a0aa2..bde40efc7046 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -1152,6 +1152,8 @@ done: | |||
1152 | if (ret < 0) { | 1152 | if (ret < 0) { |
1153 | if (sync) | 1153 | if (sync) |
1154 | iounmap(sync); | 1154 | iounmap(sync); |
1155 | |||
1156 | otg_put_transceiver(musb->xceiv); | ||
1155 | usb_nop_xceiv_unregister(); | 1157 | usb_nop_xceiv_unregister(); |
1156 | } | 1158 | } |
1157 | return ret; | 1159 | return ret; |
@@ -1166,6 +1168,8 @@ int musb_platform_exit(struct musb *musb) | |||
1166 | musb->board_set_power(0); | 1168 | musb->board_set_power(0); |
1167 | 1169 | ||
1168 | iounmap(musb->sync_va); | 1170 | iounmap(musb->sync_va); |
1171 | |||
1172 | otg_put_transceiver(musb->xceiv); | ||
1169 | usb_nop_xceiv_unregister(); | 1173 | usb_nop_xceiv_unregister(); |
1170 | return 0; | 1174 | return 0; |
1171 | } | 1175 | } |