Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Himangi Saraogi and committed by
Greg Kroah-Hartman
f71373c0 56c87c0d

+4 -6
+4 -6
drivers/staging/android/ion/tegra/tegra_ion.c
··· 32 32 33 33 num_heaps = pdata->nr; 34 34 35 - heaps = kzalloc(sizeof(struct ion_heap *) * pdata->nr, GFP_KERNEL); 35 + heaps = devm_kzalloc(&pdev->dev, 36 + sizeof(struct ion_heap *) * pdata->nr, 37 + GFP_KERNEL); 36 38 37 39 idev = ion_device_create(NULL); 38 - if (IS_ERR_OR_NULL(idev)) { 39 - kfree(heaps); 40 + if (IS_ERR_OR_NULL(idev)) 40 41 return PTR_ERR(idev); 41 - } 42 42 43 43 /* create the heaps as specified in the board file */ 44 44 for (i = 0; i < num_heaps; i++) { ··· 58 58 if (heaps[i]) 59 59 ion_heap_destroy(heaps[i]); 60 60 } 61 - kfree(heaps); 62 61 return err; 63 62 } 64 63 ··· 69 70 ion_device_destroy(idev); 70 71 for (i = 0; i < num_heaps; i++) 71 72 ion_heap_destroy(heaps[i]); 72 - kfree(heaps); 73 73 return 0; 74 74 } 75 75