mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-19 02:04:19 +08:00
drivers/video/msm/mddi_client_nt35399.c: use devm_ functions
The various devm_ functions allocate memory that is released when a driver detaches. This patch replaces the use of kzalloc by devm_kzalloc. Additionally, this patch fixes a memory leak: some memory was allocated for 'panel' but not released when the subsequent call to setup_vsync fails. Signed-off-by: Damien Cassou <damien.cassou@lifl.fr> Acked-by: David Brown <davidb@codeaurora.org> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
This commit is contained in:
parent
b7e69add39
commit
a654ddac08
@ -189,7 +189,8 @@ static int mddi_nt35399_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
struct panel_info *panel = kzalloc(sizeof(struct panel_info),
|
struct panel_info *panel = devm_kzalloc(&pdev->dev,
|
||||||
|
sizeof(struct panel_info),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
|
||||||
printk(KERN_DEBUG "%s: enter.\n", __func__);
|
printk(KERN_DEBUG "%s: enter.\n", __func__);
|
||||||
@ -233,7 +234,6 @@ static int mddi_nt35399_remove(struct platform_device *pdev)
|
|||||||
struct panel_info *panel = platform_get_drvdata(pdev);
|
struct panel_info *panel = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
setup_vsync(panel, 0);
|
setup_vsync(panel, 0);
|
||||||
kfree(panel);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user