Skip to content

Commit

Permalink
OMAPFB: use devm_kzalloc to allocate omapfb2_device
Browse files Browse the repository at this point in the history
Use devm_kzalloc to allocate omapfb2_device. This fixes possible memory
leak:

drivers/video/omap2/omapfb/omapfb-main.c:2553 omapfb_probe() warn:
possible memory leak of 'fbdev'

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Tomi Valkeinen committed Dec 13, 2012
1 parent 8105c94 commit 057eeae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/video/omap2/omapfb/omapfb-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,6 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev)
}

dev_set_drvdata(fbdev->dev, NULL);
kfree(fbdev);
}

static int omapfb_create_framebuffers(struct omapfb2_device *fbdev)
Expand Down Expand Up @@ -2413,7 +2412,8 @@ static int __init omapfb_probe(struct platform_device *pdev)
goto err0;
}

fbdev = kzalloc(sizeof(struct omapfb2_device), GFP_KERNEL);
fbdev = devm_kzalloc(&pdev->dev, sizeof(struct omapfb2_device),
GFP_KERNEL);
if (fbdev == NULL) {
r = -ENOMEM;
goto err0;
Expand Down

0 comments on commit 057eeae

Please sign in to comment.