Skip to content

Commit

Permalink
mfd: sm501: Fix leaks in probe()
Browse files Browse the repository at this point in the history
[ Upstream commit 8ce24f8 ]

This code should clean up if sm501_init_dev() fails.

Fixes: b6d6454 ("[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>
  • Loading branch information
Dan Carpenter authored and gregkh committed Oct 29, 2020
1 parent 2eb24b3 commit 1ab21ba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/mfd/sm501.c
Original file line number Diff line number Diff line change
Expand Up @@ -1415,8 +1415,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_mem_region(sm->io_res->start, 0x100);
err_res:
Expand Down

0 comments on commit 1ab21ba

Please sign in to comment.