Skip to content

Commit 8ce24f8

Browse files
Dan CarpenterLee Jones
authored andcommitted
mfd: sm501: Fix leaks in probe()
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]>
1 parent 529a110 commit 8ce24f8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/mfd/sm501.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,14 @@ static int sm501_plat_probe(struct platform_device *dev)
14151415
goto err_claim;
14161416
}
14171417

1418-
return sm501_init_dev(sm);
1418+
ret = sm501_init_dev(sm);
1419+
if (ret)
1420+
goto err_unmap;
1421+
1422+
return 0;
14191423

1424+
err_unmap:
1425+
iounmap(sm->regs);
14201426
err_claim:
14211427
release_mem_region(sm->io_res->start, 0x100);
14221428
err_res:

0 commit comments

Comments
 (0)