aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r--drivers/i2c/busses/i2c-imx.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 22cf200ecb3e..433d3486de04 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -479,6 +479,11 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
479 goto fail1; 479 goto fail1;
480 } 480 }
481 481
482 if (!request_mem_region(res->start, res_size, DRIVER_NAME)) {
483 ret = -EBUSY;
484 goto fail2;
485 }
486
482 /* Setup i2c_imx driver structure */ 487 /* Setup i2c_imx driver structure */
483 strcpy(i2c_imx->adapter.name, pdev->name); 488 strcpy(i2c_imx->adapter.name, pdev->name);
484 i2c_imx->adapter.owner = THIS_MODULE; 489 i2c_imx->adapter.owner = THIS_MODULE;
@@ -494,7 +499,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
494 if (IS_ERR(i2c_imx->clk)) { 499 if (IS_ERR(i2c_imx->clk)) {
495 ret = PTR_ERR(i2c_imx->clk); 500 ret = PTR_ERR(i2c_imx->clk);
496 dev_err(&pdev->dev, "can't get I2C clock\n"); 501 dev_err(&pdev->dev, "can't get I2C clock\n");
497 goto fail2; 502 goto fail3;
498 } 503 }
499 clk_enable(i2c_imx->clk); 504 clk_enable(i2c_imx->clk);
500 505
@@ -502,7 +507,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
502 ret = request_irq(i2c_imx->irq, i2c_imx_isr, 0, pdev->name, i2c_imx); 507 ret = request_irq(i2c_imx->irq, i2c_imx_isr, 0, pdev->name, i2c_imx);
503 if (ret) { 508 if (ret) {
504 dev_err(&pdev->dev, "can't claim irq %d\n", i2c_imx->irq); 509 dev_err(&pdev->dev, "can't claim irq %d\n", i2c_imx->irq);
505 goto fail3; 510 goto fail4;
506 } 511 }
507 512
508 /* Init queue */ 513 /* Init queue */
@@ -525,7 +530,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
525 ret = i2c_add_numbered_adapter(&i2c_imx->adapter); 530 ret = i2c_add_numbered_adapter(&i2c_imx->adapter);
526 if (ret < 0) { 531 if (ret < 0) {
527 dev_err(&pdev->dev, "registration failed\n"); 532 dev_err(&pdev->dev, "registration failed\n");
528 goto fail4; 533 goto fail5;
529 } 534 }
530 535
531 /* Set up platform driver data */ 536 /* Set up platform driver data */
@@ -542,11 +547,13 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
542 547
543 return 0; /* Return OK */ 548 return 0; /* Return OK */
544 549
545fail4: 550fail5:
546 free_irq(i2c_imx->irq, i2c_imx); 551 free_irq(i2c_imx->irq, i2c_imx);
547fail3: 552fail4:
548 clk_disable(i2c_imx->clk); 553 clk_disable(i2c_imx->clk);
549 clk_put(i2c_imx->clk); 554 clk_put(i2c_imx->clk);
555fail3:
556 release_mem_region(i2c_imx->res->start, resource_size(res));
550fail2: 557fail2:
551 kfree(i2c_imx); 558 kfree(i2c_imx);
552fail1: 559fail1:
@@ -584,6 +591,7 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
584 clk_disable(i2c_imx->clk); 591 clk_disable(i2c_imx->clk);
585 clk_put(i2c_imx->clk); 592 clk_put(i2c_imx->clk);
586 593
594 release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res));
587 iounmap(i2c_imx->base); 595 iounmap(i2c_imx->base);
588 kfree(i2c_imx); 596 kfree(i2c_imx);
589 return 0; 597 return 0;