mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
i2c: imx: call ioremap only after request_mem_region
accordingly adapt order of release_mem_region and release_mem_region on remove. Signed-off-by: Uwe Kleine-König <[email protected]> Cc: Ben Dooks <[email protected]> Cc: Wolfram Sang <[email protected]> Cc: Richard Zhao <[email protected]> Cc: Darius Augulis <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: [email protected] Acked-by: Wolfram Sang <[email protected]> Signed-off-by: Ben Dooks <[email protected]>
This commit is contained in:
parent
a1ee06b729
commit
4927fbf11d
1 changed files with 11 additions and 10 deletions
|
|
@ -497,22 +497,23 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
res_size = resource_size(res);
|
||||
|
||||
if (!request_mem_region(res->start, res_size, DRIVER_NAME)) {
|
||||
ret = -EBUSY;
|
||||
goto fail0;
|
||||
}
|
||||
|
||||
base = ioremap(res->start, res_size);
|
||||
if (!base) {
|
||||
dev_err(&pdev->dev, "ioremap failed\n");
|
||||
ret = -EIO;
|
||||
goto fail0;
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
i2c_imx = kzalloc(sizeof(struct imx_i2c_struct), GFP_KERNEL);
|
||||
if (!i2c_imx) {
|
||||
dev_err(&pdev->dev, "can't allocate interface\n");
|
||||
ret = -ENOMEM;
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
if (!request_mem_region(res->start, res_size, DRIVER_NAME)) {
|
||||
ret = -EBUSY;
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
|
|
@ -583,11 +584,11 @@ fail5:
|
|||
fail4:
|
||||
clk_put(i2c_imx->clk);
|
||||
fail3:
|
||||
release_mem_region(i2c_imx->res->start, resource_size(res));
|
||||
fail2:
|
||||
kfree(i2c_imx);
|
||||
fail1:
|
||||
fail2:
|
||||
iounmap(base);
|
||||
fail1:
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
fail0:
|
||||
if (pdata && pdata->exit)
|
||||
pdata->exit(&pdev->dev);
|
||||
|
|
@ -619,8 +620,8 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
|
|||
|
||||
clk_put(i2c_imx->clk);
|
||||
|
||||
release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res));
|
||||
iounmap(i2c_imx->base);
|
||||
release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res));
|
||||
kfree(i2c_imx);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue