From patchwork Wed Oct 24 11:29:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 15167 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1TQz9P-0002WL-Cp for patchwork@linuxtv.org; Wed, 24 Oct 2012 13:29:31 +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 1TQz9O-00030u-FU; Wed, 24 Oct 2012 13:29:31 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754870Ab2JXL33 (ORCPT ); Wed, 24 Oct 2012 07:29:29 -0400 Received: from mail-qa0-f46.google.com ([209.85.216.46]:54847 "EHLO mail-qa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754073Ab2JXL32 (ORCPT ); Wed, 24 Oct 2012 07:29:28 -0400 Received: by mail-qa0-f46.google.com with SMTP id c26so2465388qad.19 for ; Wed, 24 Oct 2012 04:29:27 -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=esaKhNGUdyvQh09k9gTD+Vc5BVDUKh167rF6Q8OFgeM=; b=DRV6fNa/gCyK++FdV89sPDHb6Dl0K49kF6nR7UTfcggb4ebxeYHryKtrEooNAv/Ggw P/2AEu+goM4p5n13bE3H9a/jmTzqifu/2oIsn78eBzVFaUYrMl4cO2FTJWUgEw7ez1Xc Hyj6PmNvQ6+t0ygs2YfZxuTBeTTJWH87wlDXwCTeYQRwGV3crKcLSiwA/MdEGdTcpRBu DKgYuuiG/CQ+UsVPh0G8CEHddXRvLtFN5aENSFSY9HG/Bo0abc/1BTwmsWIaD/IIGTAM bQBdy/9imtjYpNz1Ua/+iCR1TM5ixP2xvcvjHSnGHh7e61yDvAQMafImLmG5stGtAxao m21g== MIME-Version: 1.0 Received: by 10.49.104.3 with SMTP id ga3mr8706891qeb.11.1351078167438; Wed, 24 Oct 2012 04:29:27 -0700 (PDT) Received: by 10.229.114.30 with HTTP; Wed, 24 Oct 2012 04:29:27 -0700 (PDT) Date: Wed, 24 Oct 2012 19:29:27 +0800 Message-ID: Subject: [PATCH] [media] vpif_display: 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_display.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_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;