@@ -1559,14 +1559,20 @@ static int coda_open(struct file *file)
list_add(&ctx->list, &dev->instances);
coda_unlock(ctx);
- clk_prepare_enable(dev->clk_per);
- clk_prepare_enable(dev->clk_ahb);
+ ret = clk_prepare_enable(dev->clk_per);
+ if (ret)
+ goto err;
+
+ ret = clk_prepare_enable(dev->clk_ahb);
+ goto err_clk_ahb;
v4l2_dbg(1, coda_debug, &dev->v4l2_dev, "Created instance %d (%p)\n",
ctx->idx, ctx);
return 0;
+err_clk_ahb:
+ clk_disable_unprepare(dev->clk_per);
err:
v4l2_fh_del(&ctx->fh);
v4l2_fh_exit(&ctx->fh);