[media] s5p-fimc: add unlock on error path
authorDan Carpenter <error27@gmail.com>
Thu, 21 Oct 2010 19:22:43 +0000 (16:22 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 23 Oct 2010 00:03:25 +0000 (22:03 -0200)
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>
drivers/media/video/s5p-fimc/fimc-core.c

index 4b655461d3990d05235ad57ba5d277da48a03b50..2e7c547894b687d9fd37288e365ceae704dbcbfc 100644 (file)
@@ -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;
 }