aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2014-01-02 21:15:04 -0500
committerBrian Norris <computersforpeace@gmail.com>2014-01-07 13:07:32 -0500
commited0b272ed25fb947af1cc71973b986be6dd19d04 (patch)
tree5b51cbd6d1d53510a6c129f7a6f3eca1f8fcc3d3 /drivers/mtd
parentbb13bec74efd279942f8cf53fc86fb671acc5d9d (diff)
mtd: ixp4xx: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/maps/ixp4xx.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 10debfea81e7..d6b2451eab1d 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -13,6 +13,7 @@
13 * 13 *
14 */ 14 */
15 15
16#include <linux/err.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/init.h> 19#include <linux/init.h>
@@ -162,13 +163,6 @@ static int ixp4xx_flash_remove(struct platform_device *dev)
162 mtd_device_unregister(info->mtd); 163 mtd_device_unregister(info->mtd);
163 map_destroy(info->mtd); 164 map_destroy(info->mtd);
164 } 165 }
165 if (info->map.virt)
166 iounmap(info->map.virt);
167
168 if (info->res) {
169 release_resource(info->res);
170 kfree(info->res);
171 }
172 166
173 if (plat->exit) 167 if (plat->exit)
174 plat->exit(); 168 plat->exit();
@@ -194,7 +188,8 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
194 return err; 188 return err;
195 } 189 }
196 190
197 info = kzalloc(sizeof(struct ixp4xx_flash_info), GFP_KERNEL); 191 info = devm_kzalloc(&dev->dev, sizeof(struct ixp4xx_flash_info),
192 GFP_KERNEL);
198 if(!info) { 193 if(!info) {
199 err = -ENOMEM; 194 err = -ENOMEM;
200 goto Error; 195 goto Error;
@@ -220,20 +215,9 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
220 info->map.write = ixp4xx_probe_write16; 215 info->map.write = ixp4xx_probe_write16;
221 info->map.copy_from = ixp4xx_copy_from; 216 info->map.copy_from = ixp4xx_copy_from;
222 217
223 info->res = request_mem_region(dev->resource->start, 218 info->map.virt = devm_ioremap_resource(&dev->dev, dev->resource);
224 resource_size(dev->resource), 219 if (IS_ERR(info->map.virt)) {
225 "IXP4XXFlash"); 220 err = PTR_ERR(info->map.virt);
226 if (!info->res) {
227 printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n");
228 err = -ENOMEM;
229 goto Error;
230 }
231
232 info->map.virt = ioremap(dev->resource->start,
233 resource_size(dev->resource));
234 if (!info->map.virt) {
235 printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
236 err = -EIO;
237 goto Error; 221 goto Error;
238 } 222 }
239 223