Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61e80e79 authored by Yuan Can's avatar Yuan Can Committed by Greg Kroah-Hartman
Browse files

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: 0fae1989 ("HSI: omap_ssi: built omap_ssi and omap_ssi_port into one module")
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 7ae85631
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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);