Message ID | CAPgLHd-ivjzSDre+DMVK+mHNpNynoLWJXK36zGW5GRnU0Z4d3g@mail.gmail.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) 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 <patchwork@linuxtv.org> 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 <rfc822;patchwork@linuxtv.org>); 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 <rfc822;linux-media@vger.kernel.org>); Wed, 24 Oct 2012 07:29:28 -0400 Received: by mail-qa0-f46.google.com with SMTP id c26so2465388qad.19 for <linux-media@vger.kernel.org>; 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: <CAPgLHd-ivjzSDre+DMVK+mHNpNynoLWJXK36zGW5GRnU0Z4d3g@mail.gmail.com> Subject: [PATCH] [media] vpif_display: fix return value check in vpif_reqbufs() From: Wei Yongjun <weiyj.lk@gmail.com> To: mchehab@infradead.org Cc: yongjun_wei@trendmicro.com.cn, linux-media@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> 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 ' |
Commit Message
Wei Yongjun
Oct. 24, 2012, 11:29 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> 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 <yongjun_wei@trendmicro.com.cn> --- 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
Comments
Hi Wei, Thanks for the patch. On Wed, Oct 24, 2012 at 4:59 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote: > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> > > 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 <yongjun_wei@trendmicro.com.cn> > --- > drivers/media/platform/davinci/vpif_display.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > 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)) { Right check would be IS_ERR_OR_NULL(). Can you merge this patch 'vpif_capture: fix return value check in vpif_reqbufs()' with this one and post a v2 with above changes ? Regards, --Prabhakar Lad > 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; > > -- > 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 -- 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
Hi Prabhakar, On 11/09/2012 08:33 PM, Prabhakar Lad wrote: > Hi Wei, > > Thanks for the patch. > > On Wed, Oct 24, 2012 at 4:59 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote: >> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >> >> 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 <yongjun_wei@trendmicro.com.cn> >> --- >> drivers/media/platform/davinci/vpif_display.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> 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)) { > Right check would be IS_ERR_OR_NULL(). Can you merge this > patch 'vpif_capture: fix return value check in vpif_reqbufs()' with > this one and post a v2 with above changes ? I will merge those two patch into one. And I never see vb2_dma_contig_init_ctx() can return NULL as a return value, we still would using IS_ERR_OR_NULL()? --------------------------------------------------- void *vb2_dma_contig_init_ctx(struct device *dev) { struct vb2_dc_conf *conf; conf = kzalloc(sizeof *conf, GFP_KERNEL); if (!conf) return ERR_PTR(-ENOMEM); conf->dev = dev; return conf; } --------------------------------------------------- -- 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
Hi Wei, On Mon, Nov 12, 2012 at 2:14 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote: > Hi Prabhakar, > > On 11/09/2012 08:33 PM, Prabhakar Lad wrote: >> Hi Wei, >> >> Thanks for the patch. >> >> On Wed, Oct 24, 2012 at 4:59 PM, Wei Yongjun <weiyj.lk@gmail.com> wrote: >>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >>> >>> 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 <yongjun_wei@trendmicro.com.cn> >>> --- >>> drivers/media/platform/davinci/vpif_display.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> 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)) { >> Right check would be IS_ERR_OR_NULL(). Can you merge this >> patch 'vpif_capture: fix return value check in vpif_reqbufs()' with >> this one and post a v2 with above changes ? > > I will merge those two patch into one. > And I never see vb2_dma_contig_init_ctx() can return NULL as a return > value, we still would using IS_ERR_OR_NULL()? > IS_ERR() should be Ok. Regards, --Prabhakar Lad > --------------------------------------------------- > void *vb2_dma_contig_init_ctx(struct device *dev) > { > struct vb2_dc_conf *conf; > > conf = kzalloc(sizeof *conf, GFP_KERNEL); > if (!conf) > return ERR_PTR(-ENOMEM); > > conf->dev = dev; > > return conf; > } > --------------------------------------------------- > > > > -- 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;