From patchwork Thu May 10 06:32:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 8507 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4F97823ED1 for ; Thu, 10 May 2012 06:41:54 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id F0902A18A82 for ; Thu, 10 May 2012 06:41:53 +0000 (UTC) Received: by yhpp61 with SMTP id p61so1431089yhp.11 for ; Wed, 09 May 2012 23:41:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=/Xdkktj2VURZX2rqkaoHgRbaHkZhTjsAtLbcyAjoVfM=; b=Szl6W3ghq/GRlK2EeK5pxstIN9HqylWQHagRsKxl9kpI50UvTCF0Fj367mT9sxlkUU RIfeCvWcn+3b0bJpFhkxoo3qnu0oAC/0WaDu681asDU56lSz+/YvtOi+8dh+TjVBTIn7 uuBwrPPg/KdHa6cynxFDXwU5jFSes2g0rkjZdYDPkA2MZRyy7fMDi0541wkpu3WLWVUT dcd3zxaq/8jUXD7jh8NySKv4kXyHZGzDQmOBwq/i/mj4VLT/TCREIJqDucZNjMv5uW/f 1icuhGeXfF/bLsZAIm1jCl226fI9Nyu6X+6TKeWyo6qq/VYaImj6GKz1bTYpPAkYwWwl 3wYQ== Received: by 10.50.51.163 with SMTP id l3mr1631016igo.3.1336632113239; Wed, 09 May 2012 23:41:53 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.73.147 with SMTP id q19csp71374ibj; Wed, 9 May 2012 23:41:52 -0700 (PDT) Received: by 10.68.220.134 with SMTP id pw6mr16918547pbc.149.1336632111649; Wed, 09 May 2012 23:41:51 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id hz10si9211468pbc.313.2012.05.09.23.41.50 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 May 2012 23:41:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by pbbrr4 with SMTP id rr4so1884360pbb.37 for ; Wed, 09 May 2012 23:41:50 -0700 (PDT) Received: by 10.68.218.130 with SMTP id pg2mr172742pbc.4.1336632110322; Wed, 09 May 2012 23:41:50 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id vc4sm3015084pbc.8.2012.05.09.23.41.46 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 May 2012 23:41:49 -0700 (PDT) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: mchehab@infradead.org, k.debski@samsung.com, kyungmin.park@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 1/2] [media] s5p-mfc: Fix NULL pointer warnings Date: Thu, 10 May 2012 12:02:00 +0530 Message-Id: <1336631521-24820-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQkisTmEJK72/fC5E/SbL1oL+TAxL+szngXlIlgW3jafhVWg3aND3S3XVFOirv5es8nKDQiT Fixes the following type of warnings detected by sparse: warning: Using plain integer as NULL pointer. Signed-off-by: Sachin Kamat Acked-by: Kamil Debski --- drivers/media/video/s5p-mfc/s5p_mfc.c | 10 +++++----- drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c | 16 ++++++++-------- drivers/media/video/s5p-mfc/s5p_mfc_opr.c | 26 +++++++++++++------------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/media/video/s5p-mfc/s5p_mfc.c b/drivers/media/video/s5p-mfc/s5p_mfc.c index 83fe461..ac2dac9 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc.c @@ -373,7 +373,7 @@ static void s5p_mfc_handle_error(struct s5p_mfc_ctx *ctx, /* If no context is available then all necessary * processing has been done. */ - if (ctx == 0) + if (ctx == NULL) return; dev = ctx->dev; @@ -429,7 +429,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx, struct s5p_mfc_dev *dev; unsigned int guard_width, guard_height; - if (ctx == 0) + if (ctx == NULL) return; dev = ctx->dev; if (ctx->c_ops->post_seq_start) { @@ -496,7 +496,7 @@ static void s5p_mfc_handle_init_buffers(struct s5p_mfc_ctx *ctx, struct s5p_mfc_dev *dev; unsigned long flags; - if (ctx == 0) + if (ctx == NULL) return; dev = ctx->dev; s5p_mfc_clear_int_flags(dev); @@ -772,7 +772,7 @@ err_queue_init: err_init_hw: s5p_mfc_release_firmware(dev); err_alloc_fw: - dev->ctx[ctx->num] = 0; + dev->ctx[ctx->num] = NULL; del_timer_sync(&dev->watchdog_timer); s5p_mfc_clock_off(); err_pwr_enable: @@ -849,7 +849,7 @@ static int s5p_mfc_release(struct file *file) } mfc_debug(2, "Shutting down clock\n"); s5p_mfc_clock_off(); - dev->ctx[ctx->num] = 0; + dev->ctx[ctx->num] = NULL; s5p_mfc_dec_ctrls_delete(ctx); v4l2_fh_del(&ctx->fh); v4l2_fh_exit(&ctx->fh); diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c index f2481a8..08a5cfe 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c @@ -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( dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], dev->fw_size); if (IS_ERR(s5p_mfc_bitproc_buf)) { - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; mfc_err("Allocating bitprocessor buffer failed\n"); release_firmware(fw_blob); return -ENOMEM; @@ -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"); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys = 0; - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; release_firmware(fw_blob); return -EIO; } @@ -72,7 +72,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) mfc_err("Bitprocessor memory remap failed\n"); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys = 0; - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; release_firmware(fw_blob); return -EIO; } @@ -82,7 +82,7 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev) if (IS_ERR(b_base)) { vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys = 0; - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; mfc_err("Allocating bank2 base failed\n"); release_firmware(fw_blob); return -ENOMEM; @@ -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"); vb2_dma_contig_memops.put(s5p_mfc_bitproc_buf); s5p_mfc_bitproc_phys = 0; - s5p_mfc_bitproc_buf = 0; + s5p_mfc_bitproc_buf = NULL; release_firmware(fw_blob); return -EIO; } @@ -126,7 +126,7 @@ int s5p_mfc_reload_firmware(struct s5p_mfc_dev *dev) release_firmware(fw_blob); 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"); release_firmware(fw_blob); return -EINVAL; @@ -146,9 +146,9 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) if (!s5p_mfc_bitproc_buf) return -EINVAL; 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_buf = 0; + s5p_mfc_bitproc_buf = NULL; return 0; } diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_opr.c b/drivers/media/video/s5p-mfc/s5p_mfc_opr.c index e08b21c..a802829 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_opr.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_opr.c @@ -43,7 +43,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx) ctx->desc_buf = vb2_dma_contig_memops.alloc( dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], DESC_BUF_SIZE); if (IS_ERR_VALUE((int)ctx->desc_buf)) { - ctx->desc_buf = 0; + ctx->desc_buf = NULL; mfc_err("Allocating DESC buffer failed\n"); return -ENOMEM; } @@ -54,7 +54,7 @@ int s5p_mfc_alloc_dec_temp_buffers(struct s5p_mfc_ctx *ctx) if (desc_virt == NULL) { vb2_dma_contig_memops.put(ctx->desc_buf); ctx->desc_phys = 0; - ctx->desc_buf = 0; + ctx->desc_buf = NULL; mfc_err("Remapping DESC buffer failed\n"); return -ENOMEM; } @@ -69,7 +69,7 @@ void s5p_mfc_release_dec_desc_buffer(struct s5p_mfc_ctx *ctx) if (ctx->desc_phys) { vb2_dma_contig_memops.put(ctx->desc_buf); 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) ctx->bank1_buf = vb2_dma_contig_memops.alloc( dev->alloc_ctx[MFC_BANK1_ALLOC_CTX], ctx->bank1_size); if (IS_ERR(ctx->bank1_buf)) { - ctx->bank1_buf = 0; + ctx->bank1_buf = NULL; printk(KERN_ERR "Buf alloc for decoding failed (port A)\n"); return -ENOMEM; @@ -200,7 +200,7 @@ int s5p_mfc_alloc_codec_buffers(struct s5p_mfc_ctx *ctx) ctx->bank2_buf = vb2_dma_contig_memops.alloc( dev->alloc_ctx[MFC_BANK2_ALLOC_CTX], ctx->bank2_size); if (IS_ERR(ctx->bank2_buf)) { - ctx->bank2_buf = 0; + ctx->bank2_buf = NULL; mfc_err("Buf alloc for decoding failed (port B)\n"); return -ENOMEM; } @@ -216,13 +216,13 @@ void s5p_mfc_release_codec_buffers(struct s5p_mfc_ctx *ctx) { if (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_size = 0; } if (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_size = 0; } @@ -244,7 +244,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx) if (IS_ERR(ctx->ctx_buf)) { mfc_err("Allocating context buffer failed\n"); ctx->ctx_phys = 0; - ctx->ctx_buf = 0; + ctx->ctx_buf = NULL; return -ENOMEM; } ctx->ctx_phys = s5p_mfc_mem_cookie( @@ -256,7 +256,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx) mfc_err("Remapping instance buffer failed\n"); vb2_dma_contig_memops.put(ctx->ctx_buf); ctx->ctx_phys = 0; - ctx->ctx_buf = 0; + ctx->ctx_buf = NULL; return -ENOMEM; } /* Zero content of the allocated memory */ @@ -265,7 +265,7 @@ int s5p_mfc_alloc_instance_buffer(struct s5p_mfc_ctx *ctx) if (s5p_mfc_init_shm(ctx) < 0) { vb2_dma_contig_memops.put(ctx->ctx_buf); ctx->ctx_phys = 0; - ctx->ctx_buf = 0; + ctx->ctx_buf = NULL; return -ENOMEM; } return 0; @@ -277,12 +277,12 @@ void s5p_mfc_release_instance_buffer(struct s5p_mfc_ctx *ctx) if (ctx->ctx_buf) { vb2_dma_contig_memops.put(ctx->ctx_buf); ctx->ctx_phys = 0; - ctx->ctx_buf = 0; + ctx->ctx_buf = NULL; } if (ctx->shm_alloc) { vb2_dma_contig_memops.put(ctx->shm_alloc); - ctx->shm_alloc = 0; - ctx->shm = 0; + ctx->shm_alloc = NULL; + ctx->shm = NULL; } }