mtd: docg3: Use devm_*() functions
Subsystems (4)
PATCH v3 1/8 mtd: docg3: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.
---
No change since v2.
drivers/mtd/devices/docg3.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/mtd/devices/docg3.c +6 -14
@@ -2047,21 +2047,21 @@ static int __init docg3_probe(struct platform_device *pdev) ress =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!ress) {dev_err (dev,"No I/O memory resource defined\n" ); - goto noress; +return ret; } - base =ioremap (ress->start,DOC_IOSPACE_SIZE ); + base =devm_ioremap (dev, ress->start,DOC_IOSPACE_SIZE ); ret = -ENOMEM ; - cascade =kzalloc (sizeof (*cascade) *DOC_MAX_NBFLOORS , -GFP_KERNEL ); + cascade =devm_kzalloc (dev,sizeof (*cascade) *DOC_MAX_NBFLOORS , +GFP_KERNEL );if (!cascade) - goto nomem1; +return ret; cascade->base = base;mutex_init (&cascade->lock); cascade->bch =init_bch (DOC_ECC_BCH_M ,DOC_ECC_BCH_T ,DOC_ECC_BCH_PRIMPOLY );if (!cascade->bch) - goto nomem2; +return ret;for (floor =0 ; floor <DOC_MAX_NBFLOORS ; floor++) { mtd =doc_probe_device (cascade, floor, dev);
@@ -2101,11 +2101,6 @@ err_probe:for (floor =0 ; floor <DOC_MAX_NBFLOORS ; floor++)if (cascade->floors[floor])doc_release_device (cascade->floors[floor]); -nomem2: -kfree (cascade); -nomem1: -iounmap (base); -noress:return ret; }
@@ -2119,7 +2114,6 @@ static int __exit docg3_release(struct platform_device *pdev) {struct docg3_cascade *cascade =platform_get_drvdata (pdev);struct docg3 *docg3 = cascade->floors[0 ]->priv; -void __iomem *base = cascade->base;int floor;doc_unregister_sysfs (pdev, cascade);
@@ -2129,8 +2123,6 @@ static int __exit docg3_release(struct platform_device *pdev)doc_release_device (cascade->floors[floor]);free_bch (docg3->cascade->bch); -kfree (cascade); -iounmap (base);return 0 ; }
Signature · 1 line
1.7.10.4
PATCH v3 2/8 mtd: ixp4xx: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.
---
No change since v2.
drivers/mtd/maps/ixp4xx.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-)
drivers/mtd/maps/ixp4xx.c +5 -22
@@ -162,13 +162,6 @@ static int ixp4xx_flash_remove(struct platform_device *dev)mtd_device_unregister (info->mtd);map_destroy (info->mtd); } -if (info->map.virt) -iounmap (info->map.virt); - -if (info->res) { -release_resource (info->res); -kfree (info->res); - }if (plat->exit) plat->exit ();
@@ -194,7 +187,8 @@ static int ixp4xx_flash_probe(struct platform_device *dev)return err; } - info =kzalloc (sizeof (struct ixp4xx_flash_info ),GFP_KERNEL ); + info =devm_kzalloc (&dev->dev,sizeof (struct ixp4xx_flash_info ), +GFP_KERNEL );if (!info) { err = -ENOMEM ; goto Error;
@@ -220,20 +214,9 @@ static int ixp4xx_flash_probe(struct platform_device *dev) info->map.write = ixp4xx_probe_write16; info->map.copy_from = ixp4xx_copy_from; - info->res =request_mem_region (dev->resource->start, -resource_size (dev->resource), -"IXP4XXFlash" ); -if (!info->res) { -printk (KERN_ERR "IXP4XXFlash: Could not reserve memory region\n" ); - err = -ENOMEM ; - goto Error; - } - - info->map.virt =ioremap (dev->resource->start, -resource_size (dev->resource)); -if (!info->map.virt) { -printk (KERN_ERR "IXP4XXFlash: Failed to ioremap region\n" ); - err = -EIO ; + info->map.virt =devm_ioremap_resource (&dev->dev, dev->resource); +if (IS_ERR (info->map.virt)) { + err =PTR_ERR (info->map.virt); goto Error; }
Signature · 1 line
1.7.10.4
PATCH v3 3/8 mtd: lantiq-flash: Use devm_kzalloc()
In reply to Jingoo HanUse devm_kzalloc() to make cleanup paths simpler. Also, checking return value of devm_kzalloc() is added in order to check if the allocation succeded.
---
Change since v2
- Check the return value of devm_kzalloc(), per Ezequiel Garcia.
Change since v1
- Remove unnecessary goto labels, per John Crispin.
drivers/mtd/maps/lantiq-flash.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-)
drivers/mtd/maps/lantiq-flash.c +16 -21
@@ -123,24 +123,28 @@ ltq_mtd_probe(struct platform_device *pdev)return -ENODEV ; } - ltq_mtd =kzalloc (sizeof (struct ltq_mtd ),GFP_KERNEL ); + ltq_mtd =devm_kzalloc (&pdev->dev,sizeof (struct ltq_mtd ),GFP_KERNEL ); +if (!ltq_mtd) +return -ENOMEM ; +platform_set_drvdata (pdev, ltq_mtd); ltq_mtd->res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!ltq_mtd->res) {dev_err (&pdev->dev,"failed to get memory resource\n" ); - err = -ENOENT ; - goto err_out; +return -ENOENT ; } - ltq_mtd->map =kzalloc (sizeof (struct map_info ),GFP_KERNEL ); + ltq_mtd->map =devm_kzalloc (&pdev->dev,sizeof (struct map_info ), +GFP_KERNEL ); +if (!ltq_mtd->map) +return -ENOMEM ; + ltq_mtd->map->phys = ltq_mtd->res->start; ltq_mtd->map->size =resource_size (ltq_mtd->res); ltq_mtd->map->virt =devm_ioremap_resource (&pdev->dev, ltq_mtd->res); -if (IS_ERR (ltq_mtd->map->virt)) { - err =PTR_ERR (ltq_mtd->map->virt); - goto err_out; - } +if (IS_ERR (ltq_mtd->map->virt)) +return PTR_ERR (ltq_mtd->map->virt); ltq_mtd->map->name = ltq_map_name; ltq_mtd->map->bankwidth =2 ;
@@ -155,8 +159,7 @@ ltq_mtd_probe(struct platform_device *pdev)if (!ltq_mtd->mtd) {dev_err (&pdev->dev,"probing failed\n" ); - err = -ENXIO ; - goto err_free; +return -ENXIO ; } ltq_mtd->mtd->owner =THIS_MODULE ;
@@ -177,10 +180,6 @@ ltq_mtd_probe(struct platform_device *pdev) err_destroy:map_destroy (ltq_mtd->mtd); -err_free: -kfree (ltq_mtd->map); -err_out: -kfree (ltq_mtd);return err; }
@@ -189,13 +188,9 @@ ltq_mtd_remove(struct platform_device *pdev) {struct ltq_mtd *ltq_mtd =platform_get_drvdata (pdev); -if (ltq_mtd) { -if (ltq_mtd->mtd) { -mtd_device_unregister (ltq_mtd->mtd); -map_destroy (ltq_mtd->mtd); - } -kfree (ltq_mtd->map); -kfree (ltq_mtd); +if (ltq_mtd && ltq_mtd->mtd) { +mtd_device_unregister (ltq_mtd->mtd); +map_destroy (ltq_mtd->mtd); }return 0 ; }
Signature · 1 line
1.7.10.4
PATCH v3 4/8 mtd: denali_dt: Use devm_clk_get()
In reply to Jingoo HanUse devm_clk_get() to make cleanup paths simpler.
---
No change since v2.
drivers/mtd/nand/denali_dt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/nand/denali_dt.c +1 -3
@@ -108,7 +108,7 @@ static int denali_dt_probe(struct platform_device *ofdev) denali->dev->dma_mask =NULL ; } - dt->clk =clk_get (&ofdev->dev,NULL ); + dt->clk =devm_clk_get (&ofdev->dev,NULL );if (IS_ERR (dt->clk)) {dev_err (&ofdev->dev,"no clk available\n" );return PTR_ERR (dt->clk);
@@ -124,7 +124,6 @@ static int denali_dt_probe(struct platform_device *ofdev) out_disable_clk:clk_disable_unprepare (dt->clk); -clk_put (dt->clk);return ret; }
@@ -135,7 +134,6 @@ static int denali_dt_remove(struct platform_device *ofdev)denali_remove (&dt->denali);clk_disable (dt->clk); -clk_put (dt->clk);return 0 ; }
Signature · 1 line
1.7.10.4
PATCH v3 5/8 mtd: lpc32xx_slc: Use devm_*() functions
In reply to Jingoo HanUse devm_*() functions to make cleanup paths simpler.
---
No change since v2.
drivers/mtd/nand/lpc32xx_slc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/mtd/nand/lpc32xx_slc.c +3 -7
@@ -791,8 +791,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) }if (host->ncfg->wp_gpio == -EPROBE_DEFER )return -EPROBE_DEFER ; -if (gpio_is_valid (host->ncfg->wp_gpio) && -gpio_request (host->ncfg->wp_gpio,"NAND WP" )) { +if (gpio_is_valid (host->ncfg->wp_gpio) &&devm_gpio_request (&pdev->dev, + host->ncfg->wp_gpio,"NAND WP" )) {dev_err (&pdev->dev,"GPIO not available\n" );return -EBUSY ; }
@@ -808,7 +808,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) mtd->dev.parent = &pdev->dev;/* Get NAND clock */ - host->clk =clk_get (&pdev->dev,NULL ); + host->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (host->clk)) {dev_err (&pdev->dev,"Clock failure\n" ); res = -ENOENT ;
@@ -927,10 +927,8 @@ err_exit3:dma_release_channel (host->dma_chan); err_exit2:clk_disable (host->clk); -clk_put (host->clk); err_exit1:lpc32xx_wp_enable (host); -gpio_free (host->ncfg->wp_gpio);return res; }
@@ -953,9 +951,7 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)writel (tmp,SLC_CTRL (host->io_base));clk_disable (host->clk); -clk_put (host->clk);lpc32xx_wp_enable (host); -gpio_free (host->ncfg->wp_gpio);return 0 ; }
Signature · 1 line
1.7.10.4
PATCH v3 6/8 mtd: nuc900_nand: Use devm_*() functions
In reply to Jingoo HanUse devm_*() functions to make cleanup paths simpler.
---
No change since v2.
drivers/mtd/nand/nuc900_nand.c | 55 ++++++++++------------------------------ 1 file changed, 13 insertions(+), 42 deletions(-)
drivers/mtd/nand/nuc900_nand.c +13 -42
@@ -241,12 +241,10 @@ static int nuc900_nand_probe(struct platform_device *pdev) {struct nuc900_nand *nuc900_nand;struct nand_chip *chip; -int retval;struct resource *res; - retval =0 ; - - nuc900_nand =kzalloc (sizeof (struct nuc900_nand ),GFP_KERNEL ); + nuc900_nand =devm_kzalloc (&pdev->dev,sizeof (struct nuc900_nand ), +GFP_KERNEL );if (!nuc900_nand)return -ENOMEM ; chip = &(nuc900_nand->chip);
@@ -255,11 +253,9 @@ static int nuc900_nand_probe(struct platform_device *pdev) nuc900_nand->mtd.owner =THIS_MODULE ;spin_lock_init (&nuc900_nand->lock); - nuc900_nand->clk =clk_get (&pdev->dev,NULL ); -if (IS_ERR (nuc900_nand->clk)) { - retval = -ENOENT ; - goto fail1; - } + nuc900_nand->clk =devm_clk_get (&pdev->dev,NULL ); +if (IS_ERR (nuc900_nand->clk)) +return -ENOENT ;clk_enable (nuc900_nand->clk); chip->cmdfunc = nuc900_nand_command_lp;
@@ -272,57 +268,32 @@ static int nuc900_nand_probe(struct platform_device *pdev) chip->ecc.mode =NAND_ECC_SOFT ; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!res) { - retval = -ENXIO ; - goto fail1; - } +if (!res) +return -ENXIO ; -if (!request_mem_region (res->start,resource_size (res), pdev->name)) { - retval = -EBUSY ; - goto fail1; - } - - nuc900_nand->reg =ioremap (res->start,resource_size (res)); -if (!nuc900_nand->reg) { - retval = -ENOMEM ; - goto fail2; - } + nuc900_nand->reg =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (nuc900_nand->reg)) +return PTR_ERR (nuc900_nand->reg);nuc900_nand_enable (nuc900_nand); -if (nand_scan (&(nuc900_nand->mtd),1 )) { - retval = -ENXIO ; - goto fail3; - } +if (nand_scan (&(nuc900_nand->mtd),1 )) +return -ENXIO ;mtd_device_register (&(nuc900_nand->mtd), partitions,ARRAY_SIZE (partitions));platform_set_drvdata (pdev, nuc900_nand); -return retval; - -fail3:iounmap (nuc900_nand->reg); -fail2:release_mem_region (res->start,resource_size (res)); -fail1:kfree (nuc900_nand); -return retval; +return 0 ; }static int nuc900_nand_remove (struct platform_device *pdev) {struct nuc900_nand *nuc900_nand =platform_get_drvdata (pdev); -struct resource *res;nand_release (&nuc900_nand->mtd); -iounmap (nuc900_nand->reg); - - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -release_mem_region (res->start,resource_size (res)); -clk_disable (nuc900_nand->clk); -clk_put (nuc900_nand->clk); - -kfree (nuc900_nand);return 0 ; }
Signature · 1 line
1.7.10.4
PATCH v3 7/8 mtd: plat_nand: Use devm_*() functions
In reply to Jingoo HanUse devm_*() functions to make cleanup paths simpler.
---
No change since v2.
drivers/mtd/nand/plat_nand.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-)
drivers/mtd/nand/plat_nand.c +5 -25
@@ -52,25 +52,16 @@ static int plat_nand_probe(struct platform_device *pdev)return -ENXIO ;/* Allocate memory for the device structure (and zero it) */ - data =kzalloc (sizeof (struct plat_nand_data ),GFP_KERNEL ); + data =devm_kzalloc (&pdev->dev,sizeof (struct plat_nand_data ), +GFP_KERNEL );if (!data) {dev_err (&pdev->dev,"failed to allocate device structure.\n" );return -ENOMEM ; } -if (!request_mem_region (res->start,resource_size (res), -dev_name (&pdev->dev))) { -dev_err (&pdev->dev,"request_mem_region failed\n" ); - err = -EBUSY ; - goto out_free; - } - - data->io_base =ioremap (res->start,resource_size (res)); -if (data->io_base ==NULL ) { -dev_err (&pdev->dev,"ioremap failed\n" ); - err = -EIO ; - goto out_release_io; - } + data->io_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (data->io_base)) +return PTR_ERR (data->io_base); data->chip.priv = &data; data->mtd.priv = &data->chip;
@@ -122,11 +113,6 @@ static int plat_nand_probe(struct platform_device *pdev) out:if (pdata->ctrl.remove) pdata->ctrl.remove (pdev); -iounmap (data->io_base); -out_release_io: -release_mem_region (res->start,resource_size (res)); -out_free: -kfree (data);return err; }
@@ -137,16 +123,10 @@ static int plat_nand_remove(struct platform_device *pdev) {struct plat_nand_data *data =platform_get_drvdata (pdev);struct platform_nand_data *pdata =dev_get_platdata (&pdev->dev); -struct resource *res; - - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );nand_release (&data->mtd);if (pdata->ctrl.remove) pdata->ctrl.remove (pdev); -iounmap (data->io_base); -release_mem_region (res->start,resource_size (res)); -kfree (data);return 0 ; }
Signature · 1 line
1.7.10.4
PATCH v3 8/8 mtd: tmio_nand: Use devm_*() functions
In reply to Jingoo HanUse devm_*() functions to make cleanup paths simpler.
---
No change since v2.
drivers/mtd/nand/tmio_nand.c | 46 ++++++++++++------------------------------ 1 file changed, 13 insertions(+), 33 deletions(-)
drivers/mtd/nand/tmio_nand.c +13 -33
@@ -371,11 +371,9 @@ static int tmio_probe(struct platform_device *dev)if (data ==NULL )dev_warn (&dev->dev,"NULL platform data!\n" ); - tmio =kzalloc (sizeof *tmio,GFP_KERNEL ); -if (!tmio) { - retval = -ENOMEM ; - goto err_kzalloc; - } + tmio =devm_kzalloc (&dev->dev,sizeof (*tmio),GFP_KERNEL ); +if (!tmio) +return -ENOMEM ; tmio->dev = dev;
@@ -385,22 +383,18 @@ static int tmio_probe(struct platform_device *dev) mtd->priv = nand_chip; mtd->name ="tmio-nand" ; - tmio->ccr =ioremap (ccr->start,resource_size (ccr)); -if (!tmio->ccr) { - retval = -EIO ; - goto err_iomap_ccr; - } + tmio->ccr =devm_ioremap (&dev->dev, ccr->start,resource_size (ccr)); +if (!tmio->ccr) +return -EIO ; tmio->fcr_base = fcr->start &0xfffff ; - tmio->fcr =ioremap (fcr->start,resource_size (fcr)); -if (!tmio->fcr) { - retval = -EIO ; - goto err_iomap_fcr; - } + tmio->fcr =devm_ioremap (&dev->dev, fcr->start,resource_size (fcr)); +if (!tmio->fcr) +return -EIO ; retval =tmio_hw_init (dev, tmio);if (retval) - goto err_hwinit; +return retval;/* Set address of NAND IO lines */ nand_chip->IO_ADDR_R = tmio->fcr;
@@ -428,7 +422,8 @@ static int tmio_probe(struct platform_device *dev)/* 15 us command delay time */ nand_chip->chip_delay =15 ; - retval =request_irq (irq, &tmio_irq,0 ,dev_name (&dev->dev), tmio); + retval =devm_request_irq (&dev->dev, irq, &tmio_irq,0 , +dev_name (&dev->dev), tmio);if (retval) {dev_err (&dev->dev,"request_irq error %d\n" , retval); goto err_irq;
@@ -440,7 +435,7 @@ static int tmio_probe(struct platform_device *dev)/* Scan to find existence of the device */ if (nand_scan (mtd,1 )) { retval = -ENODEV ; - goto err_scan; + goto err_irq; }/* Register the partitions */ retval = mtd_device_parse_register(mtd, NULL, NULL,
@@ -451,18 +446,8 @@ static int tmio_probe(struct platform_device *dev)nand_release (mtd); -err_scan: -if (tmio->irq) -free_irq (tmio->irq, tmio); err_irq:tmio_hw_stop (dev, tmio); -err_hwinit: -iounmap (tmio->fcr); -err_iomap_fcr: -iounmap (tmio->ccr); -err_iomap_ccr: -kfree (tmio); -err_kzalloc:return retval; }
@@ -471,12 +456,7 @@ static int tmio_remove(struct platform_device *dev)struct tmio_nand *tmio =platform_get_drvdata (dev);nand_release (&tmio->mtd); -if (tmio->irq) -free_irq (tmio->irq, tmio);tmio_hw_stop (dev, tmio); -iounmap (tmio->fcr); -iounmap (tmio->ccr); -kfree (tmio);return 0 ; }
Signature · 1 line
1.7.10.4
Re: [PATCH V3 5/8] mtd: lpc32xx_slc: Use devm_*() functions
In reply to Jingoo HanQuoted 3 lines · Jingoo Han
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by Jingoo Han <[email protected]>
Quoted 52 lines
---
No change since v2.drivers/mtd/nand/lpc32xx_slc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/mtd/nand/lpc32xx_slc.c +3
-7@@ -791,8 +791,8 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) }if (host->ncfg->wp_gpio == -EPROBE_DEFER )return -EPROBE_DEFER ; -if (gpio_is_valid (host->ncfg->wp_gpio) && -gpio_request (host->ncfg->wp_gpio,"NAND WP" )) { +if (gpio_is_valid (host->ncfg->wp_gpio) &&devm_gpio_request (&pdev->dev, + host->ncfg->wp_gpio,"NAND WP" )) {dev_err (&pdev->dev,"GPIO not available\n" );return -EBUSY ; }@@ -808,7 +808,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) mtd->dev.parent = &pdev->dev;/* Get NAND clock */ - host->clk =clk_get (&pdev->dev,NULL ); + host->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (host->clk)) {dev_err (&pdev->dev,"Clock failure\n" ); res = -ENOENT ;@@ -927,10 +927,8 @@ err_exit3:dma_release_channel (host->dma_chan); err_exit2:clk_disable (host->clk); -clk_put (host->clk); err_exit1:lpc32xx_wp_enable (host); -gpio_free (host->ncfg->wp_gpio);return res; }@@ -953,9 +951,7 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)writel (tmp,SLC_CTRL (host->io_base));clk_disable (host->clk); -clk_put (host->clk);lpc32xx_wp_enable (host); -gpio_free (host->ncfg->wp_gpio);return 0 ; }
Quoted 3 lines · Jingoo Han
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by Jingoo Han <[email protected]>
Pushed all patches except for 2 and 7 to l2-mtd.git.
Brian
Re: [PATCH V3 8/8] mtd: tmio_nand: Use devm_*() functions
In reply to Jingoo HanQuoted 1 line · Jingoo Han
Use devm_*() functions to make cleanup paths simpler.
This patch seems to have resulted in a combination of both goto and multiple-return exit patch styles.
I see no point in using goto, if you're going to use multiple returns and it'll make introducing errors more likely in future.
please pick just one method :-)
-Ian
Quoted 108 lines
Signed-off-by Jingoo Han <[email protected]>---
No change since v2.drivers/mtd/nand/tmio_nand.c | 46 ++++++++++++------------------------------ 1 file changed, 13 insertions(+), 33 deletions(-)drivers/mtd/nand/tmio_nand.c +13
-33@@ -371,11 +371,9 @@ static int tmio_probe(struct platform_device *dev)if (data ==NULL )dev_warn (&dev->dev,"NULL platform data!\n" ); - tmio =kzalloc (sizeof *tmio,GFP_KERNEL ); -if (!tmio) { - retval = -ENOMEM ; - goto err_kzalloc; - } + tmio =devm_kzalloc (&dev->dev,sizeof (*tmio),GFP_KERNEL ); +if (!tmio) +return -ENOMEM ; tmio->dev = dev;@@ -385,22 +383,18 @@ static int tmio_probe(struct platform_device *dev) mtd->priv = nand_chip; mtd->name ="tmio-nand" ; - tmio->ccr =ioremap (ccr->start,resource_size (ccr)); -if (!tmio->ccr) { - retval = -EIO ; - goto err_iomap_ccr; - } + tmio->ccr =devm_ioremap (&dev->dev, ccr->start,resource_size (ccr)); +if (!tmio->ccr) +return -EIO ; tmio->fcr_base = fcr->start &0xfffff ; - tmio->fcr =ioremap (fcr->start,resource_size (fcr)); -if (!tmio->fcr) { - retval = -EIO ; - goto err_iomap_fcr; - } + tmio->fcr =devm_ioremap (&dev->dev, fcr->start,resource_size (fcr)); +if (!tmio->fcr) +return -EIO ; retval =tmio_hw_init (dev, tmio);if (retval) - goto err_hwinit; +return retval;/* Set address of NAND IO lines */ nand_chip->IO_ADDR_R = tmio->fcr;@@ -428,7 +422,8 @@ static int tmio_probe(struct platform_device *dev)/* 15 us command delay time */ nand_chip->chip_delay =15 ; - retval =request_irq (irq, &tmio_irq,0 ,dev_name (&dev->dev), tmio); + retval =devm_request_irq (&dev->dev, irq, &tmio_irq,0 , +dev_name (&dev->dev), tmio);if (retval) {dev_err (&dev->dev,"request_irq error %d\n" , retval); goto err_irq;@@ -440,7 +435,7 @@ static int tmio_probe(struct platform_device *dev)/* Scan to find existence of the device */ if (nand_scan (mtd,1 )) { retval = -ENODEV ; - goto err_scan; + goto err_irq; }/* Register the partitions */ retval = mtd_device_parse_register(mtd, NULL, NULL,@@ -451,18 +446,8 @@ static int tmio_probe(struct platform_device *dev)nand_release (mtd); -err_scan: -if (tmio->irq) -free_irq (tmio->irq, tmio); err_irq:tmio_hw_stop (dev, tmio); -err_hwinit: -iounmap (tmio->fcr); -err_iomap_fcr: -iounmap (tmio->ccr); -err_iomap_ccr: -kfree (tmio); -err_kzalloc:return retval; }@@ -471,12 +456,7 @@ static int tmio_remove(struct platform_device *dev)struct tmio_nand *tmio =platform_get_drvdata (dev);nand_release (&tmio->mtd); -if (tmio->irq) -free_irq (tmio->irq, tmio);tmio_hw_stop (dev, tmio); -iounmap (tmio->fcr); -iounmap (tmio->ccr); -kfree (tmio);return 0 ; }