ARM: imx: add missing kfree call in error paths
PATCH 1/1 ARM: imx: add missing kfree call in error paths
We forgot to free pdev->dev.dma_mask as it is not freed by platform_device_put().
--- arch/arm/mach-imx/mach-mx31_3ds.c | 4 +++- arch/arm/mach-imx/mach-mx31moboard.c | 4 +++- arch/arm/mach-imx/mach-mx35_3ds.c | 4 +++- arch/arm/mach-imx/mach-pcm037.c | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-imx/mach-mx31_3ds.c +3 -1
@@ -201,9 +201,11 @@ static int __init mx31_3ds_init_camera(void) goto err; ret =platform_device_add (pdev); -if (ret) +if (ret) { err: +kfree (pdev->dev.dma_mask);platform_device_put (pdev); + }return ret; }
arch/arm/mach-imx/mach-mx31moboard.c +3 -1
@@ -494,9 +494,11 @@ static int __init mx31moboard_init_cam(void) goto err; ret =platform_device_add (pdev); -if (ret) +if (ret) { err: +kfree (pdev->dev.dma_mask);platform_device_put (pdev); + }return ret;
arch/arm/mach-imx/mach-mx35_3ds.c +3 -1
@@ -284,9 +284,11 @@ static int __init imx35_3ds_init_camera(void) goto err; ret =platform_device_add (pdev); -if (ret) +if (ret) { err: +kfree (pdev->dev.dma_mask);platform_device_put (pdev); + }return ret; }
arch/arm/mach-imx/mach-pcm037.c +3 -1
@@ -427,9 +427,11 @@ static int __init pcm037_init_camera(void) goto err; ret =platform_device_add (pdev); -if (ret) +if (ret) { err: +kfree (pdev->dev.dma_mask);platform_device_put (pdev); + }return ret; }
Signature · 1 line
1.7.10.4
Quoted 3 lines · Emil Goode
We forgot to free
pdev->dev.dma_maskas it is not freed byplatform_device_put().
Every function which calls imx31_alloc_mx3_camera() is buggy. That means that, at best, it is a 2 on Rusty's API rating.
http://sweng.the-davies.net/Home/rustys-api-design-manifesto
The correct fix is to introduce an imx31_free_mx3_camera() otherwise we will just keep introducing these bugs.
regards,
dan carpenter
Hello Dan,
Quoted 11 lines · Dan Carpenter
Quoted 3 lines · Emil Goode
We forgot to free
pdev->dev.dma_maskas it is not freed byplatform_device_put().Every function which calls
imx31_alloc_mx3_camera()is buggy. That means that, at best, it is a 2 on Rusty's API rating.
http://sweng.the-davies.net/Home/rustys-api-design-manifestoThe correct fix is to introduce an
imx31_free_mx3_camera()otherwise we will just keep introducing these bugs.
I guess I could add this to arch/arm/mach-imx/devices/platform-ipu-core.c it would be a very small function though.
Best regards,
Emil Goode
Quoted 12 lines · Emil Goode
Hello Dan,
Quoted 9 lines · Dan Carpenter
Quoted 3 lines · Emil Goode
We forgot to free
pdev->dev.dma_maskas it is not freed byplatform_device_put().Every function which calls
imx31_alloc_mx3_camera()is buggy. That means that, at best, it is a 2 on Rusty's API rating.
http://sweng.the-davies.net/Home/rustys-api-design-manifesto
Quoted 5 lines
Quoted 2 lines
The correct fix is to introduce an
imx31_free_mx3_camera()otherwise we will just keep introducing these bugs.I guess I could add this to
arch/arm/mach-imx/devices/platform-ipu-core.cit would be a very small function though.
A small function is fine. :)
regards,
dan carpenter