Commit 29adc2c0 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mauro Carvalho Chehab

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

There was an unlock missing if kzalloc() failed.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent aa55f3a4
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment