mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 23:08:42 +07:00
media: vpss: clean up resources in init
If platform_driver_register() fails within vpss_init() resources are not cleaned up. The patch fixes this issue by introducing the corresponding error handling. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
d70cca7323
commit
9c487b0b0e
@ -505,19 +505,31 @@ static void vpss_exit(void)
|
||||
|
||||
static int __init vpss_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!request_mem_region(VPSS_CLK_CTRL, 4, "vpss_clock_control"))
|
||||
return -EBUSY;
|
||||
|
||||
oper_cfg.vpss_regs_base2 = ioremap(VPSS_CLK_CTRL, 4);
|
||||
if (unlikely(!oper_cfg.vpss_regs_base2)) {
|
||||
release_mem_region(VPSS_CLK_CTRL, 4);
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto err_ioremap;
|
||||
}
|
||||
|
||||
writel(VPSS_CLK_CTRL_VENCCLKEN |
|
||||
VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
|
||||
VPSS_CLK_CTRL_DACCLKEN, oper_cfg.vpss_regs_base2);
|
||||
|
||||
return platform_driver_register(&vpss_driver);
|
||||
ret = platform_driver_register(&vpss_driver);
|
||||
if (ret)
|
||||
goto err_pd_register;
|
||||
|
||||
return 0;
|
||||
|
||||
err_pd_register:
|
||||
iounmap(oper_cfg.vpss_regs_base2);
|
||||
err_ioremap:
|
||||
release_mem_region(VPSS_CLK_CTRL, 4);
|
||||
return ret;
|
||||
}
|
||||
subsys_initcall(vpss_init);
|
||||
module_exit(vpss_exit);
|
||||
|
Loading…
Reference in New Issue
Block a user