]> rtime.felk.cvut.cz Git - linux-imx.git/commit
USB: MUSB: fix kernel WARNING/oops when unloading module in OTG mode
authorSergei Shtylyov <sshtylyov@ru.mvista.com>
Wed, 29 Sep 2010 06:54:29 +0000 (09:54 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 22 Nov 2010 18:59:57 +0000 (10:59 -0800)
commit5b6ebed8ce478bf5392091c1359af3241ccea6e4
treee6954cfcfacd8c2132741bbcba8dfdb87e652731
parent3c95a4f95e6c492af203105c7d9315a9e0164b63
USB: MUSB: fix kernel WARNING/oops when unloading module in OTG mode

commit f405387435a85a440d1ce16f3ca36e042281643a upstream.

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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/musb/blackfin.c
drivers/usb/musb/davinci.c
drivers/usb/musb/musb_core.c
drivers/usb/musb/omap2430.c
drivers/usb/musb/tusb6010.c