Commit 1259762f authored by Sachin Kamat's avatar Sachin Kamat Committed by Mauro Carvalho Chehab

[media] s5p-mfc: Fix NULL pointer warnings

Fixes the following type of warnings detected by sparse:
warning: Using plain integer as NULL pointer.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Acked-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e6364a98
...@@ -373,7 +373,7 @@ static void s5p_mfc_handle_error(struct s5p_mfc_ctx *ctx, ...@@ -373,7 +373,7 @@ static void s5p_mfc_handle_error(struct s5p_mfc_ctx *ctx,
/* If no context is available then all necessary /* If no context is available then all necessary
* processing has been done. */ * processing has been done. */
if (ctx == 0) if (ctx == NULL)
return; return;
dev = ctx->dev; dev = ctx->dev;
...@@ -429,7 +429,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx, ...@@ -429,7 +429,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx,
struct s5p_mfc_dev *dev; struct s5p_mfc_dev *dev;
unsigned int guard_width, guard_height; unsigned int guard_width, guard_height;
if (ctx == 0) if (ctx == NULL)
return; return;
dev = ctx->dev; dev = ctx->dev;
if (ctx->c_ops->post_seq_start) { if (ctx->c_ops->post_seq_start) {
...@@ -496,7 +496,7 @@ static void s5p_mfc_handle_init_buffers(struct s5p_mfc_ctx *ctx, ...@@ -496,7 +496,7 @@ static void s5p_mfc_handle_init_buffers(struct s5p_mfc_ctx *ctx,
struct s5p_mfc_dev *dev; struct s5p_mfc_dev *dev;
unsigned long flags; unsigned long flags;
if (ctx == 0) if (ctx == NULL)
return; return;
dev = ctx->dev; dev = ctx->dev;
s5p_mfc_clear_int_flags(dev); s5p_mfc_clear_int_flags(dev);
...@@ -772,7 +772,7 @@ static int s5p_mfc_open(struct file *file) ...@@ -772,7 +772,7 @@ static int s5p_mfc_open(struct file *file)
err_init_hw: err_init_hw:
s5p_mfc_release_firmware(dev); s5p_mfc_release_firmware(dev);
err_alloc_fw: err_alloc_fw:
dev->ctx[ctx->num] = 0; dev->ctx[ctx->num] = NULL;
del_timer_sync(&dev->watchdog_timer); del_timer_sync(&dev->watchdog_timer);
s5p_mfc_clock_off(); s5p_mfc_clock_off();
err_pwr_enable: err_pwr_enable:
...@@ -849,7 +849,7 @@ static int s5p_mfc_release(struct file *file) ...@@ -849,7 +849,7 @@ static int s5p_mfc_release(struct file *file)
} }
mfc_debug(2, "Shutting down clock\n"); mfc_debug(2, "Shutting down clock\n");
s5p_mfc_clock_off(); s5p_mfc_clock_off();
dev->ctx[ctx->num] = 0; dev->ctx[ctx->num] = NULL;
s5p_mfc_dec_ctrls_delete(ctx); s5p_mfc_dec_ctrls_delete(ctx);
v4l2_fh_del(&ctx->fh); v4l2_fh_del(&ctx->fh);
v4l2_fh_exit(&ctx->fh); v4l2_fh_exit(&ctx->fh);
......
...@@ -52,7 +52,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) ...@@ -52,7 +52,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)
s5p_mfc_bitproc_buf = vb2_dma_contig_memops.alloc( s5p_mfc_bitproc_buf = vb2_dma_contig_memops.alloc(
dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], dev->fw_size); dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], dev->fw_size);
if (IS_ERR(s5p_mfc_bitproc_buf)) { if (IS_ERR(s5p_mfc_bitproc_buf)) {
s5p_mfc_bitproc_buf = 0; s5p_mfc_bitproc_buf = NULL;
mfc_err("Allocating bitprocessor buffer failed\n"); mfc_err("Allocating bitprocessor buffer failed\n");
release_firmware(fw_blob); release_firmware(fw_blob);
return -ENOMEM; return -ENOMEM;
...@@ -63,7 +63,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) ...@@ -63,7 +63,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)
mfc_err("The base memory for bank 1 is not aligned to 128KB\n"); mfc_err("The base memory for bank 1 is not aligned to 128KB\n");
vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf);
s5p_mfc_bitproc_phys = 0; s5p_mfc_bitproc_phys = 0;
s5p_mfc_bitproc_buf = 0; s5p_mfc_bitproc_buf = NULL;
release_firmware(fw_blob); release_firmware(fw_blob);
return -EIO; return -EIO;
} }
...@@ -72,7 +72,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) ...@@ -72,7 +72,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)
mfc_err("Bitprocessor memory remap failed\n"); mfc_err("Bitprocessor memory remap failed\n");
vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf);
s5p_mfc_bitproc_phys = 0; s5p_mfc_bitproc_phys = 0;
s5p_mfc_bitproc_buf = 0; s5p_mfc_bitproc_buf = NULL;
release_firmware(fw_blob); release_firmware(fw_blob);
return -EIO; return -EIO;
} }
...@@ -82,7 +82,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) ...@@ -82,7 +82,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)
if (IS_ERR(b_base)) { if (IS_ERR(b_base)) {
vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf);
s5p_mfc_bitproc_phys = 0; s5p_mfc_bitproc_phys = 0;
s5p_mfc_bitproc_buf = 0; s5p_mfc_bitproc_buf = NULL;
mfc_err("Allocating bank2 base failed\n"); mfc_err("Allocating bank2 base failed\n");
release_firmware(fw_blob); release_firmware(fw_blob);
return -ENOMEM; return -ENOMEM;
...@@ -94,7 +94,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) ...@@ -94,7 +94,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)
mfc_err("The base memory for bank 2 is not aligned to 128KB\n"); mfc_err("The base memory for bank 2 is not aligned to 128KB\n");
vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf);
s5p_mfc_bitproc_phys = 0; s5p_mfc_bitproc_phys = 0;
s5p_mfc_bitproc_buf = 0; s5p_mfc_bitproc_buf = NULL;
release_firmware(fw_blob); release_firmware(fw_blob);
return -EIO; return -EIO;
} }
...@@ -126,7 +126,7 @@ int s5p_mfc_reload_firmware(struct s5p_mfc_dev *dev) ...@@ -126,7 +126,7 @@ int s5p_mfc_reload_firmware(struct s5p_mfc_dev *dev)
release_firmware(fw_blob); release_firmware(fw_blob);
return -ENOMEM; return -ENOMEM;
} }
if (s5p_mfc_bitproc_buf == 0 || s5p_mfc_bitproc_phys == 0) { if (s5p_mfc_bitproc_buf == NULL || s5p_mfc_bitproc_phys == 0) {
mfc_err("MFC firmware is not allocated or was not mapped correctly\n"); mfc_err("MFC firmware is not allocated or was not mapped correctly\n");
release_firmware(fw_blob); release_firmware(fw_blob);
return -EINVAL; return -EINVAL;
...@@ -146,9 +146,9 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) ...@@ -146,9 +146,9 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev)
if (!s5p_mfc_bitproc_buf) if (!s5p_mfc_bitproc_buf)
return -EINVAL; return -EINVAL;
vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf);
s5p_mfc_bitproc_virt = 0; s5p_mfc_bitproc_virt = NULL;
s5p_mfc_bitproc_phys = 0; s5p_mfc_bitproc_phys = 0;
s5p_mfc_bitproc_buf = 0; s5p_mfc_bitproc_buf = NULL;
return 0; return 0;
} }
......
...@@ -43,7 +43,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx) ...@@ -43,7 +43,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx)
ctx->desc_buf = vb2_dma_contig_memops.alloc( ctx->desc_buf = vb2_dma_contig_memops.alloc(
dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], DESC_BUF_SIZE); dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], DESC_BUF_SIZE);
if (IS_ERR_VALUE((int)ctx->desc_buf)) { if (IS_ERR_VALUE((int)ctx->desc_buf)) {
ctx->desc_buf = 0; ctx->desc_buf = NULL;
mfc_err("Allocating DESC buffer failed\n"); mfc_err("Allocating DESC buffer failed\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -54,7 +54,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx) ...@@ -54,7 +54,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx)
if (desc_virt == NULL) { if (desc_virt == NULL) {
vb2_dma_contig_memops.put(ctx->desc_buf); vb2_dma_contig_memops.put(ctx->desc_buf);
ctx->desc_phys = 0; ctx->desc_phys = 0;
ctx->desc_buf = 0; ctx->desc_buf = NULL;
mfc_err("Remapping DESC buffer failed\n"); mfc_err("Remapping DESC buffer failed\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -69,7 +69,7 @@ void s5p_mfc_release_dec_desc_buffer(struct s5p_mfc_ctx *ctx) ...@@ -69,7 +69,7 @@ void s5p_mfc_release_dec_desc_buffer(struct s5p_mfc_ctx *ctx)
if (ctx->desc_phys) { if (ctx->desc_phys) {
vb2_dma_contig_memops.put(ctx->desc_buf); vb2_dma_contig_memops.put(ctx->desc_buf);
ctx->desc_phys = 0; ctx->desc_phys = 0;
ctx->desc_buf = 0; ctx->desc_buf = NULL;
} }
} }
...@@ -186,7 +186,7 @@ int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx) ...@@ -186,7 +186,7 @@ int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx)
ctx->bank1_buf = vb2_dma_contig_memops.alloc( ctx->bank1_buf = vb2_dma_contig_memops.alloc(
dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], ctx->bank1_size); dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], ctx->bank1_size);
if (IS_ERR(ctx->bank1_buf)) { if (IS_ERR(ctx->bank1_buf)) {
ctx->bank1_buf = 0; ctx->bank1_buf = NULL;
printk(KERN_ERR printk(KERN_ERR
"Buf alloc for decoding failed (port A)\n"); "Buf alloc for decoding failed (port A)\n");
return -ENOMEM; return -ENOMEM;
...@@ -200,7 +200,7 @@ int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx) ...@@ -200,7 +200,7 @@ int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx)
ctx->bank2_buf = vb2_dma_contig_memops.alloc( ctx->bank2_buf = vb2_dma_contig_memops.alloc(
dev->alloc_ctx[MFC_BANK2_ALLOC_CTX], ctx->bank2_size); dev->alloc_ctx[MFC_BANK2_ALLOC_CTX], ctx->bank2_size);
if (IS_ERR(ctx->bank2_buf)) { if (IS_ERR(ctx->bank2_buf)) {
ctx->bank2_buf = 0; ctx->bank2_buf = NULL;
mfc_err("Buf alloc for decoding failed (port B)\n"); mfc_err("Buf alloc for decoding failed (port B)\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -216,13 +216,13 @@ void s5p_mfc_release_codec_buffers(struct s5p_mfc_ctx *ctx) ...@@ -216,13 +216,13 @@ void s5p_mfc_release_codec_buffers(struct s5p_mfc_ctx *ctx)
{ {
if (ctx->bank1_buf) { if (ctx->bank1_buf) {
vb2_dma_contig_memops.put(ctx->bank1_buf); vb2_dma_contig_memops.put(ctx->bank1_buf);
ctx->bank1_buf = 0; ctx->bank1_buf = NULL;
ctx->bank1_phys = 0; ctx->bank1_phys = 0;
ctx->bank1_size = 0; ctx->bank1_size = 0;
} }
if (ctx->bank2_buf) { if (ctx->bank2_buf) {
vb2_dma_contig_memops.put(ctx->bank2_buf); vb2_dma_contig_memops.put(ctx->bank2_buf);
ctx->bank2_buf = 0; ctx->bank2_buf = NULL;
ctx->bank2_phys = 0; ctx->bank2_phys = 0;
ctx->bank2_size = 0; ctx->bank2_size = 0;
} }
...@@ -244,7 +244,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx) ...@@ -244,7 +244,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx)
if (IS_ERR(ctx->ctx_buf)) { if (IS_ERR(ctx->ctx_buf)) {
mfc_err("Allocating context buffer failed\n"); mfc_err("Allocating context buffer failed\n");
ctx->ctx_phys = 0; ctx->ctx_phys = 0;
ctx->ctx_buf = 0; ctx->ctx_buf = NULL;
return -ENOMEM; return -ENOMEM;
} }
ctx->ctx_phys = s5p_mfc_mem_cookie( ctx->ctx_phys = s5p_mfc_mem_cookie(
...@@ -256,7 +256,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx) ...@@ -256,7 +256,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx)
mfc_err("Remapping instance buffer failed\n"); mfc_err("Remapping instance buffer failed\n");
vb2_dma_contig_memops.put(ctx->ctx_buf); vb2_dma_contig_memops.put(ctx->ctx_buf);
ctx->ctx_phys = 0; ctx->ctx_phys = 0;
ctx->ctx_buf = 0; ctx->ctx_buf = NULL;
return -ENOMEM; return -ENOMEM;
} }
/* Zero content of the allocated memory */ /* Zero content of the allocated memory */
...@@ -265,7 +265,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx) ...@@ -265,7 +265,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx)
if (s5p_mfc_init_shm(ctx) < 0) { if (s5p_mfc_init_shm(ctx) < 0) {
vb2_dma_contig_memops.put(ctx->ctx_buf); vb2_dma_contig_memops.put(ctx->ctx_buf);
ctx->ctx_phys = 0; ctx->ctx_phys = 0;
ctx->ctx_buf = 0; ctx->ctx_buf = NULL;
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
...@@ -277,12 +277,12 @@ void s5p_mfc_release_instance_buffer(struct s5p_mfc_ctx *ctx) ...@@ -277,12 +277,12 @@ void s5p_mfc_release_instance_buffer(struct s5p_mfc_ctx *ctx)
if (ctx->ctx_buf) { if (ctx->ctx_buf) {
vb2_dma_contig_memops.put(ctx->ctx_buf); vb2_dma_contig_memops.put(ctx->ctx_buf);
ctx->ctx_phys = 0; ctx->ctx_phys = 0;
ctx->ctx_buf = 0; ctx->ctx_buf = NULL;
} }
if (ctx->shm_alloc) { if (ctx->shm_alloc) {
vb2_dma_contig_memops.put(ctx->shm_alloc); vb2_dma_contig_memops.put(ctx->shm_alloc);
ctx->shm_alloc = 0; ctx->shm_alloc = NULL;
ctx->shm = 0; ctx->shm = NULL;
} }
} }
......
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