@@ -187,19 +187,18 @@ static int __devinit scoop_probe(struct platform_device *pdev)
if (!mem)
return -EINVAL;
- devptr = kzalloc(sizeof(struct scoop_dev), GFP_KERNEL);
+ devptr = devm_kzalloc(&pdev->dev, sizeof(struct scoop_dev), GFP_KERNEL);
+
if (!devptr)
return -ENOMEM;
spin_lock_init(&devptr->scoop_lock);
inf = pdev->dev.platform_data;
- devptr->base = ioremap(mem->start, resource_size(mem));
+ devptr->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
- if (!devptr->base) {
- ret = -ENOMEM;
- goto err_ioremap;
- }
+ if (!devptr->base)
+ return -ENOMEM;
platform_set_drvdata(pdev, devptr);
@@ -234,12 +233,9 @@ static int __devinit scoop_probe(struct platform_device *pdev)
if (devptr->gpio.base != -1)
temp = gpiochip_remove(&devptr->gpio);
+
err_gpio:
platform_set_drvdata(pdev, NULL);
-err_ioremap:
- iounmap(devptr->base);
- kfree(devptr);
-
return ret;
}
@@ -260,8 +256,6 @@ static int __devexit scoop_remove(struct platform_device *pdev)
}
platform_set_drvdata(pdev, NULL);
- iounmap(sdev->base);
- kfree(sdev);
return 0;
}