1
0
Fork 0

mfd: sm501: Fix leaks in probe()

[ Upstream commit 8ce24f8967 ]

This code should clean up if sm501_init_dev() fails.

Fixes: b6d6454fdb ("[PATCH] mfd: SM501 core driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Dan Carpenter 2020-09-11 14:33:26 +03:00 committed by Greg Kroah-Hartman
parent df63949a27
commit 1dbf9d994b
1 changed files with 7 additions and 1 deletions

View File

@ -1424,8 +1424,14 @@ static int sm501_plat_probe(struct platform_device *dev)
goto err_claim;
}
return sm501_init_dev(sm);
ret = sm501_init_dev(sm);
if (ret)
goto err_unmap;
return 0;
err_unmap:
iounmap(sm->regs);
err_claim:
release_resource(sm->regs_claim);
kfree(sm->regs_claim);