aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-04-07 05:21:05 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:57:05 -0400
commit2b080c5df00e431baec09222aa8d623f0cd77314 (patch)
treef4e187ea085fb54d2e6e72ca87a2eb3dbfccc67d /drivers
parent3f113e36106f133752de47208816b28aa8e60f88 (diff)
V4L/DVB: davinci: don't return under lock on error path
If the kmalloc() failed for "ccdc_cfg = kmalloc(...);" then we would exit with the lock held. I moved the mutex_lock() below the allocation because it isn't protecting anything in that block and allocations are allocations are sometimes slow. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Vaibhav Hiremath <hvaibhav@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/davinci/vpfe_capture.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index d4676ad41f39..f6648f6ba2fc 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -1861,7 +1861,6 @@ static __init int vpfe_probe(struct platform_device *pdev)
1861 goto probe_free_dev_mem; 1861 goto probe_free_dev_mem;
1862 } 1862 }
1863 1863
1864 mutex_lock(&ccdc_lock);
1865 /* Allocate memory for ccdc configuration */ 1864 /* Allocate memory for ccdc configuration */
1866 ccdc_cfg = kmalloc(sizeof(struct ccdc_config), GFP_KERNEL); 1865 ccdc_cfg = kmalloc(sizeof(struct ccdc_config), GFP_KERNEL);
1867 if (NULL == ccdc_cfg) { 1866 if (NULL == ccdc_cfg) {
@@ -1870,6 +1869,8 @@ static __init int vpfe_probe(struct platform_device *pdev)
1870 goto probe_free_lock; 1869 goto probe_free_lock;
1871 } 1870 }
1872 1871
1872 mutex_lock(&ccdc_lock);
1873
1873 strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32); 1874 strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32);
1874 /* Get VINT0 irq resource */ 1875 /* Get VINT0 irq resource */
1875 res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1876 res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);