提交 29adc2c0 编写于 作者: D Dan Carpenter 提交者: Mauro Carvalho Chehab

[media] s5p-fimc: add unlock on error path

There was an unlock missing if kzalloc() failed.
Signed-off-by: NDan Carpenter <error27@gmail.com>
Acked-by: NSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 aa55f3a4
...@@ -1320,16 +1320,18 @@ static int fimc_m2m_open(struct file *file) ...@@ -1320,16 +1320,18 @@ static int fimc_m2m_open(struct file *file)
* is already opened. * is already opened.
*/ */
if (fimc->vid_cap.refcnt > 0) { if (fimc->vid_cap.refcnt > 0) {
mutex_unlock(&fimc->lock); err = -EBUSY;
return -EBUSY; goto err_unlock;
} }
fimc->m2m.refcnt++; fimc->m2m.refcnt++;
set_bit(ST_OUTDMA_RUN, &fimc->state); set_bit(ST_OUTDMA_RUN, &fimc->state);
ctx = kzalloc(sizeof *ctx, GFP_KERNEL); ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
if (!ctx) if (!ctx) {
return -ENOMEM; err = -ENOMEM;
goto err_unlock;
}
file->private_data = ctx; file->private_data = ctx;
ctx->fimc_dev = fimc; ctx->fimc_dev = fimc;
...@@ -1349,6 +1351,7 @@ static int fimc_m2m_open(struct file *file) ...@@ -1349,6 +1351,7 @@ static int fimc_m2m_open(struct file *file)
kfree(ctx); kfree(ctx);
} }
err_unlock:
mutex_unlock(&fimc->lock); mutex_unlock(&fimc->lock);
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册