This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] V4L: soc-camera: explicitly free allocated managed memory on 
error
Author:  Guennadi Liakhovetski <[email protected]>
Date:    Sat May 3 13:05:08 2014 -0300

devm_kzalloc() allocations are freed when the device is unbound. But if a
certain path fails and the allocated memory cannot be used anyway it is
better to free it explicitly immediately. This patch does exactly this if
asynchronous group probing in scan_async_group() fails after memory has
been allocated.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/platform/soc_camera/soc_camera.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=f061b7e6f34512b6bb4a99e9e07d046c2e7ff4b2

diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
b/drivers/media/platform/soc_camera/soc_camera.c
index 7fec8cd..dc626b9 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1524,14 +1524,14 @@ static int scan_async_group(struct soc_camera_host *ici,
 
        ret = soc_camera_dyn_pdev(&sdesc, sasc);
        if (ret < 0)
-               return ret;
+               goto eallocpdev;
 
        sasc->sensor = &sasd->asd;
 
        icd = soc_camera_add_pdev(sasc);
        if (!icd) {
-               platform_device_put(sasc->pdev);
-               return -ENOMEM;
+               ret = -ENOMEM;
+               goto eaddpdev;
        }
 
        sasc->notifier.subdevs = asd;
@@ -1559,7 +1559,11 @@ static int scan_async_group(struct soc_camera_host *ici,
        v4l2_clk_unregister(icd->clk);
 eclkreg:
        icd->clk = NULL;
-       platform_device_unregister(sasc->pdev);
+       platform_device_del(sasc->pdev);
+eaddpdev:
+       platform_device_put(sasc->pdev);
+eallocpdev:
+       devm_kfree(ici->v4l2_dev.dev, sasc);
        dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret);
 
        return ret;

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to