From patchwork Wed Apr 29 12:00:47 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: 6295561 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0894BBEEE1 for ; Wed, 29 Apr 2015 12:01:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B2FC201BB for ; Wed, 29 Apr 2015 12:01:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 38A2B2010E for ; Wed, 29 Apr 2015 12:01:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422961AbbD2MA7 (ORCPT ); Wed, 29 Apr 2015 08:00:59 -0400 Received: from mail-lb0-f175.google.com ([209.85.217.175]:34832 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422949AbbD2MA4 (ORCPT ); Wed, 29 Apr 2015 08:00:56 -0400 Received: by lbbuc2 with SMTP id uc2so18238555lbb.2; Wed, 29 Apr 2015 05:00:55 -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=agvjsXknM5q9ZrtCW6UKI+lxL5gQ1QENTkx/OvfrHCQ=; b=cTxs17BvKv71sU+bVahHWDMW9IR7fCjg0VagQy1EXVt9NDs2yvKQdLEUlrX5XYuEuI +0IIQQHBJhTar2MC5FnaQHjyVu4BR3ae23jT/WSZCxkmF9m6C+N+MXJtN74WmNtuEux1 ARkhXppK+2t+hZrGeSO1eBG4v7XUQsCb74lsJx+hGH3cFGNypYEv651trzxkwhc+fNic wHhJrJl+aSRE+0U6N4ETnUeGnPazkz40JfwVVbhwX6Ig7HAgvwBcnilX4fcadxW2hT4K gftBEDSUTqgyQfez2tVS+FaDaPJaFFvuRBiS8V0PSFGyRbbD0AN8Np4/0et2wQoUci9b d4QQ== X-Received: by 10.152.5.194 with SMTP id u2mr1335052lau.3.1430308854967; Wed, 29 Apr 2015 05:00:54 -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.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Apr 2015 05:00:54 -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 3/3] media/videobuf2-dma-vmalloc: Save output from dma_map_sg Date: Wed, 29 Apr 2015 14:00:47 +0200 Message-Id: <1430308847-32140-4-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-vmalloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c b/drivers/media/v4l2-core/videobuf2-vmalloc.c index 657ab302a5cf..2fe4c27f524a 100644 --- a/drivers/media/v4l2-core/videobuf2-vmalloc.c +++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c @@ -287,7 +287,6 @@ static struct sg_table *vb2_vmalloc_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); @@ -306,8 +305,9 @@ static struct sg_table *vb2_vmalloc_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);