mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-22 22:04:47 +08:00
bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()
[ Upstream commitf71eaf2708
] The sunxi_rsb_init() returns the platform_driver_register() directly without checking its return value, if platform_driver_register() failed, the sunxi_rsb_bus is not unregistered. Fix by unregister sunxi_rsb_bus when platform_driver_register() failed. Fixes:d787dcdb9c
("bus: sunxi-rsb: Add driver for Allwinner Reduced Serial Bus") Signed-off-by: Yuan Can <yuancan@huawei.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://lore.kernel.org/r/20221123094200.12036-1-yuancan@huawei.com Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5f4543c938
commit
bd0b17ab1b
@ -861,7 +861,13 @@ static int __init sunxi_rsb_init(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return platform_driver_register(&sunxi_rsb_driver);
|
||||
ret = platform_driver_register(&sunxi_rsb_driver);
|
||||
if (ret) {
|
||||
bus_unregister(&sunxi_rsb_bus);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(sunxi_rsb_init);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user