Re: [PATCH RFC v3 2/3] i2c: pxa: convert to devm_* API
From: Wolfram Sang
Date: Wed Jun 12 2013 - 06:00:48 EST
On Thu, May 23, 2013 at 08:00:08PM +0800, Libo Chen wrote:
> when i2c malloc faild, we should not try to call release_mem_region.
> aovid this, convert them to devm_* API.
>
> Signed-off-by: Libo Chen <libo.chen@xxxxxxxxxx>
First, you did it right. This patch should not be combined with 1/3. It
is not a trivial cleanup, so I prefer to keep them seperated.
BTW did you test these patches on real hardware?
> @@ -1198,19 +1187,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
> #endif
> return 0;
>
> -eadapt:
> - if (!i2c->use_pio)
> - free_irq(irq, i2c);
> -ereqirq:
> - clk_disable(i2c->clk);
> - iounmap(i2c->reg_base);
> -eremap:
> - clk_put(i2c->clk);
> -eclk:
> - kfree(i2c);
> -emalloc:
> - release_mem_region(res->start, resource_size(res));
> - return ret;
> }
>
> static int i2c_pxa_remove(struct platform_device *dev)
> @@ -1218,15 +1194,6 @@ static int i2c_pxa_remove(struct platform_device *dev)
> struct pxa_i2c *i2c = platform_get_drvdata(dev);
>
> i2c_del_adapter(&i2c->adap);
> - if (!i2c->use_pio)
> - free_irq(i2c->irq, i2c);
> -
> - clk_disable(i2c->clk);
> - clk_put(i2c->clk);
> -
> - iounmap(i2c->reg_base);
> - release_mem_region(i2c->iobase, i2c->iosize);
> - kfree(i2c);
You remove too much. Who disables the clock now?
Attachment:
signature.asc
Description: Digital signature