aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/Kconfig
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2013-04-02 14:20:36 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-04 06:07:34 -0400
commit9e340fdc5af6ae3041d73319bbd1438c7d6d566c (patch)
treeb6a3495de254294a65fa1decf510365d6e727f43 /drivers/video/Kconfig
parent3d20837dd6bd2891d5788c0a574edaf2b54fc377 (diff)
drivers/video/wm8505fb.c: use devm_ functions
The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. The patch makes some other cleanups. First, the original code used devm_kzalloc, but kfree. This would lead to a double free. The problem was found using the following semantic match (http://coccinelle.lip6.fr/): // <smpl> @@ expression x,e; @@ x = devm_kzalloc(...) ... when != x = e ?-kfree(x,...); // </smpl> The error-handing code of devm_request_and_ioremap does not print any warning message, because devm_request_and_ioremap does this. The call to dma_alloc_coherent is converted to its devm equivalent, dmam_alloc_coherent. This implicitly introduces a call to dmam_free_coherent, which was completly missing in the original code. A semicolon is removed at the end of the error-handling code for the call to dma_alloc_coherent. The block of code calling fb_alloc_cmap is moved below the block of code calling wm8505fb_set_par, so that the error-handing code of the call to wm8505fb_set_par can just return ret. This way there is only one block of error-handling code that needs to call fb_dealloc_cmap, and so this is moved up to the place where it is needed, eliminating the need for all gotos and labels in the function. This was suggested by Tony Prisk. The initializations of fbi and ret at the beginning of the function are not necessary and are removed. The call platform_set_drvdata(pdev, NULL); at the end of the function is also removed. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Tony Prisk <linux@prisktech.co.nz> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/Kconfig')
0 files changed, 0 insertions, 0 deletions