diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2013-08-21 10:14:17 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2013-08-24 03:06:08 -0400 |
commit | 79830db28622b3ee183a30903d50cbd92eb0fb31 (patch) | |
tree | f26cd46996a7706d244b113eebdd90ceb3914bf1 /drivers/media/platform | |
parent | f82bc203eeddb271c08637577544b30af43e047b (diff) |
[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: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/coda.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index 0894d800214c..04ced56d58f2 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
@@ -2406,8 +2406,14 @@ static int coda_open(struct file *file) | |||
2406 | ctx->reg_idx = idx; | 2406 | ctx->reg_idx = idx; |
2407 | } | 2407 | } |
2408 | 2408 | ||
2409 | clk_prepare_enable(dev->clk_per); | 2409 | ret = clk_prepare_enable(dev->clk_per); |
2410 | clk_prepare_enable(dev->clk_ahb); | 2410 | if (ret) |
2411 | goto err_clk_per; | ||
2412 | |||
2413 | ret = clk_prepare_enable(dev->clk_ahb); | ||
2414 | if (ret) | ||
2415 | goto err_clk_ahb; | ||
2416 | |||
2411 | set_default_params(ctx); | 2417 | set_default_params(ctx); |
2412 | ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, | 2418 | ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, |
2413 | &coda_queue_init); | 2419 | &coda_queue_init); |
@@ -2465,7 +2471,9 @@ err_ctrls_setup: | |||
2465 | v4l2_m2m_ctx_release(ctx->m2m_ctx); | 2471 | v4l2_m2m_ctx_release(ctx->m2m_ctx); |
2466 | err_ctx_init: | 2472 | err_ctx_init: |
2467 | clk_disable_unprepare(dev->clk_ahb); | 2473 | clk_disable_unprepare(dev->clk_ahb); |
2474 | err_clk_ahb: | ||
2468 | clk_disable_unprepare(dev->clk_per); | 2475 | clk_disable_unprepare(dev->clk_per); |
2476 | err_clk_per: | ||
2469 | v4l2_fh_del(&ctx->fh); | 2477 | v4l2_fh_del(&ctx->fh); |
2470 | v4l2_fh_exit(&ctx->fh); | 2478 | v4l2_fh_exit(&ctx->fh); |
2471 | clear_bit(ctx->idx, &dev->instance_mask); | 2479 | clear_bit(ctx->idx, &dev->instance_mask); |
@@ -2873,10 +2881,15 @@ static int coda_hw_init(struct coda_dev *dev) | |||
2873 | u16 product, major, minor, release; | 2881 | u16 product, major, minor, release; |
2874 | u32 data; | 2882 | u32 data; |
2875 | u16 *p; | 2883 | u16 *p; |
2876 | int i; | 2884 | int i, ret; |
2885 | |||
2886 | ret = clk_prepare_enable(dev->clk_per); | ||
2887 | if (ret) | ||
2888 | return ret; | ||
2877 | 2889 | ||
2878 | clk_prepare_enable(dev->clk_per); | 2890 | ret = clk_prepare_enable(dev->clk_ahb); |
2879 | clk_prepare_enable(dev->clk_ahb); | 2891 | if (ret) |
2892 | goto err_clk_ahb; | ||
2880 | 2893 | ||
2881 | /* | 2894 | /* |
2882 | * Copy the first CODA_ISRAM_SIZE in the internal SRAM. | 2895 | * Copy the first CODA_ISRAM_SIZE in the internal SRAM. |
@@ -2985,6 +2998,10 @@ static int coda_hw_init(struct coda_dev *dev) | |||
2985 | } | 2998 | } |
2986 | 2999 | ||
2987 | return 0; | 3000 | return 0; |
3001 | |||
3002 | err_clk_ahb: | ||
3003 | clk_disable_unprepare(dev->clk_per); | ||
3004 | return ret; | ||
2988 | } | 3005 | } |
2989 | 3006 | ||
2990 | static void coda_fw_callback(const struct firmware *fw, void *context) | 3007 | static void coda_fw_callback(const struct firmware *fw, void *context) |