Skip to content

Commit

Permalink
mfd: sm501: Fix leaks in probe()
Browse files Browse the repository at this point in the history
This code should clean up if sm501_init_dev() fails.

Fixes: b6d6454 ("[PATCH] mfd: SM501 core driver")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
  • Loading branch information
Dan Carpenter authored and Lee Jones committed Sep 30, 2020
1 parent 529a110 commit 8ce24f8
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 8ce24f8

Please sign in to comment.