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: 1749201 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id DB26ADF230 for ; Thu, 15 Nov 2012 13:18:20 +0000 (UTC) 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 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;