mailbox/omap: unregister mbox class
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Sat, 11 Nov 2017 18:09:18 +0000 (23:39 +0530)
committerJassi Brar <jaswinder.singh@linaro.org>
Tue, 14 Nov 2017 14:51:35 +0000 (20:21 +0530)
platform_driver_register() can fail here and we must unregister mbox
class.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/omap-mailbox.c

index c5e8b9cb170d41064b1c0b0532b64b5fd2b3b36a..2517038a8452c638aa45a11577cd20ee0dde6a20 100644 (file)
@@ -906,7 +906,11 @@ static int __init omap_mbox_init(void)
        mbox_kfifo_size = max_t(unsigned int, mbox_kfifo_size,
                                                        sizeof(mbox_msg_t));
 
-       return platform_driver_register(&omap_mbox_driver);
+       err = platform_driver_register(&omap_mbox_driver);
+       if (err)
+               class_unregister(&omap_mbox_class);
+
+       return err;
 }
 subsys_initcall(omap_mbox_init);