From patchwork Thu Nov 15 13:18:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 15462 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1TYzKn-0007yV-OI for patchwork@linuxtv.org; Thu, 15 Nov 2012 14:18:21 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-2) with esmtp for id 1TYzKm-0000pl-IY; Thu, 15 Nov 2012 14:18:21 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1767753Ab2KONST (ORCPT ); Thu, 15 Nov 2012 08:18:19 -0500 Received: from mail-qc0-f174.google.com ([209.85.216.174]:59306 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1767736Ab2KONSS (ORCPT ); Thu, 15 Nov 2012 08:18:18 -0500 Received: by mail-qc0-f174.google.com with SMTP id o22so972302qcr.19 for ; Thu, 15 Nov 2012 05:18:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=qJUu4ULYIfDsdptoJih/ok1aTw7afWyH1Fo69ZTJuSk=; b=In9X525UmiZ+PtyU6YeR1xfPLmYJxBymeaHrQ1mJ+YFKEXa7mwc4tzo/aEnwzrU86T hVNWmVW2DRjxjbXzg2Q7kh+rCyYeWB2RCdlnPQibb/KryO3AvdhWpPsJSNRoHmE9T18I QDJXSrUwvVY1Vw+W/ADIwQMn9e5v8+KVMfL7MZS3n9Zd9GfrtVi4InAcGf9YV/NuQoS9 PyhmRBRuGZMEhbPVhhPcydulcjT8Jx6YdC4SmLGk8Lu9Zh9Er8OMQDgnRAyYBaR/cQUn 2AK2rxoiUz9NGTNNvFo03tECc+oaXlxUNe3bxVybuVkBMe8CiYoOuoLgp2AuW7JuvW5D tX/Q== MIME-Version: 1.0 Received: by 10.224.19.74 with SMTP id z10mr1005144qaa.96.1352985498096; Thu, 15 Nov 2012 05:18:18 -0800 (PST) Received: by 10.229.126.165 with HTTP; Thu, 15 Nov 2012 05:18:17 -0800 (PST) Date: Thu, 15 Nov 2012 21:18:17 +0800 Message-ID: Subject: [PATCH v2] [media] vpif_capture: fix return value check From: Wei Yongjun To: mchehab@infradead.org, prabhakar.csengg@gmail.com Cc: yongjun_wei@trendmicro.com.cn, linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.11.15.130629 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' CN_TLD 0.1, FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, WEBMAIL_SOURCE 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __DATE_TZ_HK 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_HTTP_RECEIVED 0, __PHISH_SPEAR_STRUCTURE_1 0, __PHISH_SPEAR_STRUCTURE_2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' From: Wei Yongjun In case of error, the function vb2_dma_contig_init_ctx() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun Acked-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpif_display.c | 4 ++-- drivers/media/platform/davinci/vpif_capture.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index b716fbd..5453bbb 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -972,9 +972,9 @@ static int vpif_reqbufs(struct file *file, void *priv, } /* Initialize videobuf2 queue as per the buffer type */ common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); - if (!common->alloc_ctx) { + if (IS_ERR(common->alloc_ctx)) { vpif_err("Failed to get the context\n"); - return -EINVAL; + return PTR_ERR(common->alloc_ctx); } q = &common->buffer_queue; q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index fcabc02..9746324 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1004,9 +1004,9 @@ static int vpif_reqbufs(struct file *file, void *priv, /* Initialize videobuf2 queue as per the buffer type */ common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); - if (!common->alloc_ctx) { + if (IS_ERR(common->alloc_ctx)) { vpif_err("Failed to get the context\n"); - return -EINVAL; + return PTR_ERR(common->alloc_ctx); } q = &common->buffer_queue; q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;