aboutsummaryrefslogtreecommitdiff
path: root/drivers/hsi
diff options
context:
space:
mode:
authorYuan Can2022-11-24 11:33:32 +0000
committerGreg Kroah-Hartman2022-12-31 13:32:45 +0100
commit42d976bd9766a74ba87f5a8d0dcadda31378b7c7 (patch)
treea84916672326cfb57c99ab0e984c917807e1453e /drivers/hsi
parent5150b76aa2eb8bb8feb7f7a048417f9d39c3dd04 (diff)
HSI: omap_ssi_core: Fix error handling in ssi_init()
[ Upstream commit 3ffa9f713c39a213a08d9ff13ab983a8aa5d8b5d ] 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: 0fae198988b8 ("HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module") Signed-off-by: Yuan Can <yuancan@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/hsi')
-rw-r--r--drivers/hsi/controllers/omap_ssi_core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
index 052cf3e92dd6..26f2c3c01297 100644
--- a/drivers/hsi/controllers/omap_ssi_core.c
+++ b/drivers/hsi/controllers/omap_ssi_core.c
@@ -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);