• Sergei Shtylyov's avatar
    USB: MUSB: fix kernel WARNING/oops when unloading module in OTG mode · f4053874
    Sergei Shtylyov authored
    Since commit 461972d8 (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: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
    Cc: stable <stable@kernel.org>
    Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    f4053874
blackfin.c 10.1 KB