aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-10-21 15:22:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-22 20:03:25 -0400
commit29adc2c06fd7aa0a26135d8c96afd1cef9e6700b (patch)
tree1f1bcde88ad0a8572b998b08e849c7437fb487b4 /drivers/media
parentaa55f3a46fe799b3c8396c57f4b4074252f635da (diff)
[media] s5p-fimc: add unlock on error path
There was an unlock missing if kzalloc() failed. Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index 4b655461d399..2e7c547894b6 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -1320,16 +1320,18 @@ static int fimc_m2m_open(struct file *file)
1320 * is already opened. 1320 * is already opened.
1321 */ 1321 */
1322 if (fimc->vid_cap.refcnt > 0) { 1322 if (fimc->vid_cap.refcnt > 0) {
1323 mutex_unlock(&fimc->lock); 1323 err = -EBUSY;
1324 return -EBUSY; 1324 goto err_unlock;
1325 } 1325 }
1326 1326
1327 fimc->m2m.refcnt++; 1327 fimc->m2m.refcnt++;
1328 set_bit(ST_OUTDMA_RUN, &fimc->state); 1328 set_bit(ST_OUTDMA_RUN, &fimc->state);
1329 1329
1330 ctx = kzalloc(sizeof *ctx, GFP_KERNEL); 1330 ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
1331 if (!ctx) 1331 if (!ctx) {
1332 return -ENOMEM; 1332 err = -ENOMEM;
1333 goto err_unlock;
1334 }
1333 1335
1334 file->private_data = ctx; 1336 file->private_data = ctx;
1335 ctx->fimc_dev = fimc; 1337 ctx->fimc_dev = fimc;
@@ -1349,6 +1351,7 @@ static int fimc_m2m_open(struct file *file)
1349 kfree(ctx); 1351 kfree(ctx);
1350 } 1352 }
1351 1353
1354err_unlock:
1352 mutex_unlock(&fimc->lock); 1355 mutex_unlock(&fimc->lock);
1353 return err; 1356 return err;
1354} 1357}