Skip to content

Commit

Permalink
HSI: omap_ssi_core: Fix error handling in ssi_init()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Yuan Can authored and sre committed Nov 25, 2022
1 parent 8acbca3 commit 3ffa9f7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/hsi/controllers/omap_ssi_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,13 @@ static int __init ssi_init(void) {
if (ret)
return ret;

return platform_driver_register(&ssi_port_pdriver);
ret = platform_driver_register(&ssi_port_pdriver);
if (ret) {
platform_driver_unregister(&ssi_pdriver);
return ret;
}

return 0;
}
module_init(ssi_init);

Expand Down

0 comments on commit 3ffa9f7

Please sign in to comment.