Skip to content

Commit 3ffa9f7

Browse files
Yuan Cansre
authored andcommitted
HSI: omap_ssi_core: Fix error handling in ssi_init()
The ssi_init() returns the platform_driver_register() directly without checking its return value, if platform_driver_register() failed, the ssi_pdriver is not unregistered. Fix by unregister ssi_pdriver when the last platform_driver_register() failed. Fixes: 0fae198 ("HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module") Signed-off-by: Yuan Can <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 8acbca3 commit 3ffa9f7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/hsi/controllers/omap_ssi_core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,13 @@ static int __init ssi_init(void) {
631631
if (ret)
632632
return ret;
633633

634-
return platform_driver_register(&ssi_port_pdriver);
634+
ret = platform_driver_register(&ssi_port_pdriver);
635+
if (ret) {
636+
platform_driver_unregister(&ssi_pdriver);
637+
return ret;
638+
}
639+
640+
return 0;
635641
}
636642
module_init(ssi_init);
637643

0 commit comments

Comments
 (0)