From patchwork Wed Apr 29 12:00:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda Delgado X-Patchwork-Id: 6295581 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D7C649F326 for ; Wed, 29 Apr 2015 12:01:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 02753201BB for ; Wed, 29 Apr 2015 12:01:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 154DC2010E for ; Wed, 29 Apr 2015 12:01:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422987AbbD2MBV (ORCPT ); Wed, 29 Apr 2015 08:01:21 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:33016 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422927AbbD2MAz (ORCPT ); Wed, 29 Apr 2015 08:00:55 -0400 Received: by lbbzk7 with SMTP id zk7so18327308lbb.0; Wed, 29 Apr 2015 05:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+H2tr3fPw1m5tDLOafiwBltd7DgHEea9AJFPAS63/0c=; b=x0RyF8Mugi6WwSQHH7MYgLQ89SGjwaF+FnO2cZlgvfXD//YCVrWRW02eTP4dX2Ouy4 bLVf40G1BqKS5dbXynkDAU3kMWFpukAm2Bn/NvetF8utdqeLznIQSzyYkfdL/kykjGWF YpO7Ho9JOT3ju7tz2DJ9oEI3poilILRlKZRUOFwM35ZsA612C7u5iFdsPRpzcL7tRnQY eV28Lsz7nPqi4g0C8WYLYXHSGgXwAo3SuBIHPiQCbbNxJcV41kOZoik+uqIeu39hXPTL gkaosaEgLa9m+qK+OZXZV+IBhwLhKUl8vCLvckK5hMDVz9fvMZzwgXlpXoVwIxz2yXAv soHQ== X-Received: by 10.152.236.40 with SMTP id ur8mr2492958lac.19.1430308853846; Wed, 29 Apr 2015 05:00:53 -0700 (PDT) Received: from neopili.qtec.com (cpe.xe-3-0-1-778.vbrnqe10.dk.customer.tdc.net. [80.197.57.18]) by mx.google.com with ESMTPSA id lf12sm6290686lac.38.2015.04.29.05.00.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Apr 2015 05:00:53 -0700 (PDT) From: Ricardo Ribalda Delgado To: Hans Verkuil , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Subject: [RESEND PATCH v2 2/3] media/videobuf2-dma-contig: Save output from dma_map_sg Date: Wed, 29 Apr 2015 14:00:46 +0200 Message-Id: <1430308847-32140-3-git-send-email-ricardo.ribalda@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1430308847-32140-1-git-send-email-ricardo.ribalda@gmail.com> References: <1430308847-32140-1-git-send-email-ricardo.ribalda@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ricardo Ribalda dma_map_sg returns the number of areas mapped by the hardware, which could be different than the areas given as an input. The output must be saved to nent. Signed-off-by: Ricardo Ribalda Delgado Reviewed-by: Marek Szyprowski --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 644dec73d220..94c1e6455d36 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -299,7 +299,6 @@ static struct sg_table *vb2_dc_dmabuf_ops_map( /* stealing dmabuf mutex to serialize map/unmap operations */ struct mutex *lock = &db_attach->dmabuf->lock; struct sg_table *sgt; - int ret; mutex_lock(lock); @@ -318,8 +317,9 @@ static struct sg_table *vb2_dc_dmabuf_ops_map( } /* mapping to the client with new direction */ - ret = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents, dma_dir); - if (ret <= 0) { + sgt->nents = dma_map_sg(db_attach->dev, sgt->sgl, sgt->orig_nents, + dma_dir); + if (!sgt->nents) { pr_err("failed to map scatterlist\n"); mutex_unlock(lock); return ERR_PTR(-EIO);