summaryrefslogtreecommitdiffstats
path: root/drivers/staging/most/hdm-dim2
diff options
context:
space:
mode:
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>2016-02-18 20:11:36 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-20 15:02:06 -0800
commit8661fca6f679996133765fa905e9a480b8c96a74 (patch)
treed25c90d3caca08a637537f119be500756ceaaeb7 /drivers/staging/most/hdm-dim2
parent11b49d9bb63fab2f92223419a2492661e317e2ef (diff)
downloadlinux-8661fca6f679996133765fa905e9a480b8c96a74.tar.bz2
staging: most: hdm-dim2: Replace kzalloc with devm_kzalloc
Devm_ functions allocate memory that is released when a driver detaches. Replace kzalloc with devm_kzalloc and remove corresponding kfrees from probe and remove functions of a platform device. Also, an unnecessary label has been removed. Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most/hdm-dim2')
-rw-r--r--drivers/staging/most/hdm-dim2/dim2_hdm.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index 6296aa5b6d8e..97db334e5867 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -736,7 +736,7 @@ static int dim2_probe(struct platform_device *pdev)
int ret, i;
struct kobject *kobj;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev)
return -ENOMEM;
@@ -750,13 +750,13 @@ static int dim2_probe(struct platform_device *pdev)
if (!res) {
pr_err("no memory region defined\n");
ret = -ENOENT;
- goto err_free_dev;
+ return ret;
}
if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
pr_err("failed to request mem region\n");
ret = -EBUSY;
- goto err_free_dev;
+ return ret;
}
dev->io_base = ioremap(res->start, resource_size(res));
@@ -862,9 +862,7 @@ err_unmap_io:
iounmap(dev->io_base);
err_release_mem:
release_mem_region(res->start, resource_size(res));
-err_free_dev:
#endif
- kfree(dev);
return ret;
}
@@ -897,7 +895,6 @@ static int dim2_remove(struct platform_device *pdev)
iounmap(dev->io_base);
release_mem_region(res->start, resource_size(res));
#endif
- kfree(dev);
platform_set_drvdata(pdev, NULL);
/*