Skip to content

Commit

Permalink
drivers/video/msm/mddi_client_nt35399.c: use devm_ functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Damien Cassou authored and Florian Tobias Schandinat committed Aug 23, 2012
1 parent b7e69ad commit a654dda
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/video/msm/mddi_client_nt35399.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ static int mddi_nt35399_probe(struct platform_device *pdev)

int ret;

struct panel_info *panel = kzalloc(sizeof(struct panel_info),
GFP_KERNEL);
struct panel_info *panel = devm_kzalloc(&pdev->dev,
sizeof(struct panel_info),
GFP_KERNEL);

printk(KERN_DEBUG "%s: enter.\n", __func__);

Expand Down Expand Up @@ -233,7 +234,6 @@ static int mddi_nt35399_remove(struct platform_device *pdev)
struct panel_info *panel = platform_get_drvdata(pdev);

setup_vsync(panel, 0);
kfree(panel);
return 0;
}

Expand Down

0 comments on commit a654dda

Please sign in to comment.