From patchwork Thu Jun 23 13:20:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 908872 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5NDKlkd025064 for ; Thu, 23 Jun 2011 13:20:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755342Ab1FWNUp (ORCPT ); Thu, 23 Jun 2011 09:20:45 -0400 Received: from mail-vw0-f46.google.com ([209.85.212.46]:47868 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752649Ab1FWNUo (ORCPT ); Thu, 23 Jun 2011 09:20:44 -0400 Received: by vws1 with SMTP id 1so1290675vws.19 for ; Thu, 23 Jun 2011 06:20:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=J9HBlahUwcSLUFtiJK0gOnbAsVUIbV/6u1Lx65tuysI=; b=lLaHltPu+kJZuWHT85LpS0RJMoJk1NlBd1JYi95+sBGOzzFaywUB43TtAto9yOAIwd 4MnRs/3DvOMb7x1QyUqGi5/Lfmy+z4r7Vlg0NjtMs9jr+WTpSEfLnko92yIxk1xsjcgx ncMkv6yE3VqW0N5DP3VPlnQKjy2+VmEuPX8CM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=qiiKhUyDr3BiPHR5u/znWeKnX04cPKFimVX8KWAH19vIf2jTdd5bfHxHAPjqjNa9dK pC6IS/NhPeNLHb3VAzD2XY1tq1mXjQjsmBHIStlDym2VZChneGSp2BpWw/DZywvJJywu Q1/hSTORrPYv9TTj/PO5ZLgbXH4lKTYO19WkY= MIME-Version: 1.0 Received: by 10.52.165.4 with SMTP id yu4mr826220vdb.165.1308835243654; Thu, 23 Jun 2011 06:20:43 -0700 (PDT) Received: by 10.52.113.33 with HTTP; Thu, 23 Jun 2011 06:20:43 -0700 (PDT) Date: Thu, 23 Jun 2011 21:20:43 +0800 Message-ID: Subject: [PATCH] [media] videobuf2-dma-contig: return NULL if alloc fails From: Jun Nie To: Pawel Osciak , Hans Verkuil , 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-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 23 Jun 2011 13:20:48 +0000 (UTC) return NULL if alloc fails to avoid taking error code as buffer pointer Signed-off-by: Jun Nie --- drivers/media/video/videobuf2-dma-contig.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) GFP_KERNEL); @@ -48,7 +48,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", size); kfree(buf); - return ERR_PTR(-ENOMEM); + return NULL; } buf->conf = conf; diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index a790a5f..8e8c7aa 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c @@ -40,7 +40,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) buf = kzalloc(sizeof *buf, GFP_KERNEL); if (!buf) - return ERR_PTR(-ENOMEM); + return NULL; buf->vaddr = dma_alloc_coherent(conf->dev, size, &buf->paddr,