Commit f71373c0 authored by Himangi Saraogi's avatar Himangi Saraogi Committed by Greg Kroah-Hartman

staging:android: Introduce the use of the managed version of kzalloc

This patch moves shared private data kzalloc to managed devm_kzalloc and
cleans now unneccessary kfree in probe and remove functions.
Signed-off-by: default avatarHimangi Saraogi <himangi774@gmail.com>
Acked-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 56c87c0d
...@@ -32,13 +32,13 @@ static int tegra_ion_probe(struct platform_device *pdev) ...@@ -32,13 +32,13 @@ static int tegra_ion_probe(struct platform_device *pdev)
num_heaps = pdata->nr; num_heaps = pdata->nr;
heaps = kzalloc(sizeof(struct ion_heap *) * pdata->nr, GFP_KERNEL); heaps = devm_kzalloc(&pdev->dev,
sizeof(struct ion_heap *) * pdata->nr,
GFP_KERNEL);
idev = ion_device_create(NULL); idev = ion_device_create(NULL);
if (IS_ERR_OR_NULL(idev)) { if (IS_ERR_OR_NULL(idev))
kfree(heaps);
return PTR_ERR(idev); return PTR_ERR(idev);
}
/* create the heaps as specified in the board file */ /* create the heaps as specified in the board file */
for (i = 0; i < num_heaps; i++) { for (i = 0; i < num_heaps; i++) {
...@@ -58,7 +58,6 @@ static int tegra_ion_probe(struct platform_device *pdev) ...@@ -58,7 +58,6 @@ static int tegra_ion_probe(struct platform_device *pdev)
if (heaps[i]) if (heaps[i])
ion_heap_destroy(heaps[i]); ion_heap_destroy(heaps[i]);
} }
kfree(heaps);
return err; return err;
} }
...@@ -70,7 +69,6 @@ static int tegra_ion_remove(struct platform_device *pdev) ...@@ -70,7 +69,6 @@ static int tegra_ion_remove(struct platform_device *pdev)
ion_device_destroy(idev); ion_device_destroy(idev);
for (i = 0; i < num_heaps; i++) for (i = 0; i < num_heaps; i++)
ion_heap_destroy(heaps[i]); ion_heap_destroy(heaps[i]);
kfree(heaps);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment