Commit 79830db2 authored by Fabio Estevam's avatar Fabio Estevam Committed by Mauro Carvalho Chehab

[media] coda: Check the return value from clk_prepare_enable()

clk_prepare_enable() may fail, so let's check its return value and propagate it
in the case of error.
Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent f82bc203
...@@ -2406,8 +2406,14 @@ static int coda_open(struct file *file) ...@@ -2406,8 +2406,14 @@ static int coda_open(struct file *file)
ctx->reg_idx = idx; ctx->reg_idx = idx;
} }
clk_prepare_enable(dev->clk_per); ret = clk_prepare_enable(dev->clk_per);
clk_prepare_enable(dev->clk_ahb); if (ret)
goto err_clk_per;
ret = clk_prepare_enable(dev->clk_ahb);
if (ret)
goto err_clk_ahb;
set_default_params(ctx); set_default_params(ctx);
ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx,
&coda_queue_init); &coda_queue_init);
...@@ -2465,7 +2471,9 @@ static int coda_open(struct file *file) ...@@ -2465,7 +2471,9 @@ static int coda_open(struct file *file)
v4l2_m2m_ctx_release(ctx->m2m_ctx); v4l2_m2m_ctx_release(ctx->m2m_ctx);
err_ctx_init: err_ctx_init:
clk_disable_unprepare(dev->clk_ahb); clk_disable_unprepare(dev->clk_ahb);
err_clk_ahb:
clk_disable_unprepare(dev->clk_per); clk_disable_unprepare(dev->clk_per);
err_clk_per:
v4l2_fh_del(&ctx->fh); v4l2_fh_del(&ctx->fh);
v4l2_fh_exit(&ctx->fh); v4l2_fh_exit(&ctx->fh);
clear_bit(ctx->idx, &dev->instance_mask); clear_bit(ctx->idx, &dev->instance_mask);
...@@ -2873,10 +2881,15 @@ static int coda_hw_init(struct coda_dev *dev) ...@@ -2873,10 +2881,15 @@ static int coda_hw_init(struct coda_dev *dev)
u16 product, major, minor, release; u16 product, major, minor, release;
u32 data; u32 data;
u16 *p; u16 *p;
int i; int i, ret;
ret = clk_prepare_enable(dev->clk_per);
if (ret)
return ret;
clk_prepare_enable(dev->clk_per); ret = clk_prepare_enable(dev->clk_ahb);
clk_prepare_enable(dev->clk_ahb); if (ret)
goto err_clk_ahb;
/* /*
* Copy the first CODA_ISRAM_SIZE in the internal SRAM. * Copy the first CODA_ISRAM_SIZE in the internal SRAM.
...@@ -2985,6 +2998,10 @@ static int coda_hw_init(struct coda_dev *dev) ...@@ -2985,6 +2998,10 @@ static int coda_hw_init(struct coda_dev *dev)
} }
return 0; return 0;
err_clk_ahb:
clk_disable_unprepare(dev->clk_per);
return ret;
} }
static void coda_fw_callback(const struct firmware *fw, void *context) static void coda_fw_callback(const struct firmware *fw, void *context)
......
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