linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v1] i2c: busses: i2c-designware-pcidrv:- Unmap region obtained by pcim_iomap_regions
@ 2016-12-23 10:11 Arvind Yadav
  2016-12-23 10:44 ` Mika Westerberg
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Arvind Yadav @ 2016-12-23 10:11 UTC (permalink / raw)
  To: jarkko.nikula, wsa, mika.westerberg
  Cc: andriy.shevchenko, linux-i2c, linux-kernel

Release IO memory mapping, if i2c_dw_pci_probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/i2c/busses/i2c-designware-pcidrv.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index d6423cf..75e6e27 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -228,8 +228,10 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 	}
 
 	dev = devm_kzalloc(&pdev->dev, sizeof(struct dw_i2c_dev), GFP_KERNEL);
-	if (!dev)
-		return -ENOMEM;
+	if (!dev) {
+		r = -ENOMEM;
+		goto error;
+	}
 
 	dev->clk = NULL;
 	dev->controller = controller;
@@ -241,7 +243,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 	if (controller->setup) {
 		r = controller->setup(pdev, controller);
 		if (r)
-			return r;
+			goto error;
 	}
 
 	dev->functionality = controller->functionality |
@@ -270,7 +272,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 
 	r = i2c_dw_probe(dev);
 	if (r)
-		return r;
+		goto error;
 
 	pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
 	pm_runtime_use_autosuspend(&pdev->dev);
@@ -278,6 +280,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 	pm_runtime_allow(&pdev->dev);
 
 	return 0;
+error:
+	pcim_iounmap_regions(pdev, 1 << 0);
 }
 
 static void i2c_dw_pci_remove(struct pci_dev *pdev)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-23 11:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-23 10:11 [v1] i2c: busses: i2c-designware-pcidrv:- Unmap region obtained by pcim_iomap_regions Arvind Yadav
2016-12-23 10:44 ` Mika Westerberg
2016-12-23 11:27   ` Jarkko Nikula
2016-12-23 11:15 ` kbuild test robot
2016-12-23 11:55 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).