Re: [v1] i2c: busses: i2c-designware-pcidrv:- Unmap region obtained by pcim_iomap_regions

From: Andy Shevchenko
Date: Fri Dec 23 2016 - 06:55:30 EST


On Fri, 2016-12-23 at 15:41 +0530, Arvind Yadav wrote:
> Release IO memory mapping, if i2c_dw_pci_probe is not successful.
>

Second NAK, and seems (due to kbot message) you didn't even bother to
compile test.

What are you doing?

> Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
> ---
> Â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)

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy