From patchwork Wed Oct 24 11:29:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 15166 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1TQz90-0002W1-Fa for patchwork@linuxtv.org; Wed, 24 Oct 2012 13:29:06 +0200 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-3) with esmtp for id 1TQz8z-00030u-Fk; Wed, 24 Oct 2012 13:29:06 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754674Ab2JXL3D (ORCPT ); Wed, 24 Oct 2012 07:29:03 -0400 Received: from mail-qc0-f174.google.com ([209.85.216.174]:41330 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754073Ab2JXL3B (ORCPT ); Wed, 24 Oct 2012 07:29:01 -0400 Received: by mail-qc0-f174.google.com with SMTP id o22so192250qcr.19 for ; Wed, 24 Oct 2012 04:29:00 -0700 (PDT) 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=I/qfRg2axuwzthLLPcLDRsW37H74c1l94zOHfbO49g8=; b=BFGH1CFvZBYCjRVNCIf3l2XmlADwiypGRrUkm2HN7xGr73QKaMb/PxobTbNYPxZxUh AXLFVm2yrSCyIGqv6LmFz7pX+lsZQwD3Ud3YwMpvYJVNl/M9ey7zvU4FhqtAgQ6Igk6Y 55H0m8EHKIZJ5bngu3ZxU4Bh9092TrRB76lLRrdQEdZMc1PL7sI/6ukvSXbSlI2Z9F31 FAVzZ6dW3T1P9WMNUEzRoWgYVJScy/eHwDjBIUKRn5Je0RkV2RFCOgb7ONWiapFYAul9 /iu3eV10e4+K3pFkbXnEtQLGeVrnZvjRl6VoMtAxlIosXJL5QTcvQ4YDJflRVBxsXXhF 8HqQ== MIME-Version: 1.0 Received: by 10.49.63.97 with SMTP id f1mr8735205qes.4.1351078140470; Wed, 24 Oct 2012 04:29:00 -0700 (PDT) Received: by 10.229.114.30 with HTTP; Wed, 24 Oct 2012 04:29:00 -0700 (PDT) Date: Wed, 24 Oct 2012 19:29:00 +0800 Message-ID: Subject: [PATCH] [media] vpif_capture: fix return value check in vpif_reqbufs() From: Wei Yongjun To: mchehab@infradead.org 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.10.24.112125 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_1300_1399 0, BODY_SIZE_2000_LESS 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, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' 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 --- drivers/media/platform/davinci/vpif_capture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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_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;