Commit d5010964 authored by Toshihiro Kobayashi's avatar Toshihiro Kobayashi Committed by Tony Lindgren

ARM: OMAP: mailbox module stability fix

mbox objects must be initialized before request_irq().
Signed-off-by: default avatarToshihiro Kobayashi <toshihiro.kobayashi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 74b18c7a
...@@ -238,30 +238,32 @@ static int omap_mbox_init(struct omap_mbox *mbox) ...@@ -238,30 +238,32 @@ static int omap_mbox_init(struct omap_mbox *mbox)
goto fail1; goto fail1;
} }
spin_lock_init(&mbox->lock);
INIT_WORK(&mbox->msg_receive, mbox_msg_receiver, mbox);
init_waitqueue_head(&mbox->tx_waitq);
ret = mbq_init(&mbox->mbq);
if (unlikely(ret))
goto fail2;
ret = request_irq(mbox->irq, mbox_interrupt, SA_INTERRUPT, ret = request_irq(mbox->irq, mbox_interrupt, SA_INTERRUPT,
mbox->name, mbox); mbox->name, mbox);
if (unlikely(ret)) { if (unlikely(ret)) {
printk(KERN_ERR printk(KERN_ERR
"failed to register mailbox interrupt:%d\n", ret); "failed to register mailbox interrupt:%d\n", ret);
goto fail1; goto fail3;
} }
disable_mbox_irq(mbox, IRQ_RX); disable_mbox_irq(mbox, IRQ_RX);
enable_mbox_irq(mbox, IRQ_RX); enable_mbox_irq(mbox, IRQ_RX);
spin_lock_init(&mbox->lock);
INIT_WORK(&mbox->msg_receive, mbox_msg_receiver, mbox);
init_waitqueue_head(&mbox->tx_waitq);
ret = mbq_init(&mbox->mbq);
if (unlikely(ret))
goto fail2;
return 0; return 0;
fail3:
kfree(mbox->mbq);
fail2: fail2:
free_irq(mbox->irq, mbox);
class_remove_file(&omap_mbox_class, &class_attr_mbox); class_remove_file(&omap_mbox_class, &class_attr_mbox);
class_unregister(&omap_mbox_class);
fail1: fail1:
class_unregister(&omap_mbox_class);
if (unlikely(mbox->ops->shutdown)) if (unlikely(mbox->ops->shutdown))
mbox->ops->shutdown(mbox); mbox->ops->shutdown(mbox);
...@@ -271,6 +273,7 @@ static int omap_mbox_init(struct omap_mbox *mbox) ...@@ -271,6 +273,7 @@ static int omap_mbox_init(struct omap_mbox *mbox)
static void omap_mbox_shutdown(struct omap_mbox *mbox) static void omap_mbox_shutdown(struct omap_mbox *mbox)
{ {
free_irq(mbox->irq, mbox); free_irq(mbox->irq, mbox);
kfree(mbox->mbq);
class_remove_file(&omap_mbox_class, &class_attr_mbox); class_remove_file(&omap_mbox_class, &class_attr_mbox);
class_unregister(&omap_mbox_class); class_unregister(&omap_mbox_class);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment