From 29adc2c06fd7aa0a26135d8c96afd1cef9e6700b Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 21 Oct 2010 16:22:43 -0300 Subject: [PATCH] [media] s5p-fimc: add unlock on error path There was an unlock missing if kzalloc() failed. Signed-off-by: Dan Carpenter Acked-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/s5p-fimc/fimc-core.c | 11 +++++++---- 1 file 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) * is already opened. */ if (fimc->vid_cap.refcnt > 0) { - mutex_unlock(&fimc->lock); - return -EBUSY; + err = -EBUSY; + goto err_unlock; } fimc->m2m.refcnt++; set_bit(ST_OUTDMA_RUN, &fimc->state); ctx = kzalloc(sizeof *ctx, GFP_KERNEL); - if (!ctx) - return -ENOMEM; + if (!ctx) { + err = -ENOMEM; + goto err_unlock; + } file->private_data = ctx; ctx->fimc_dev = fimc; @@ -1349,6 +1351,7 @@ static int fimc_m2m_open(struct file *file) kfree(ctx); } +err_unlock: mutex_unlock(&fimc->lock); return err; } -- 2.20.1