From patchwork Wed Feb 15 17:55:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9574653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3FA926045F for ; Wed, 15 Feb 2017 17:57:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B600223C7 for ; Wed, 15 Feb 2017 17:57:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F97227D4D; Wed, 15 Feb 2017 17:57:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCE4E223C7 for ; Wed, 15 Feb 2017 17:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752238AbdBORzm (ORCPT ); Wed, 15 Feb 2017 12:55:42 -0500 Received: from mail-qk0-f193.google.com ([209.85.220.193]:33114 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750719AbdBORzl (ORCPT ); Wed, 15 Feb 2017 12:55:41 -0500 Received: by mail-qk0-f193.google.com with SMTP id 11so24271792qkl.0; Wed, 15 Feb 2017 09:55:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Hhu+ZEHwKgIw+pfgkfM2j8CQ0XSuwB9OrFXZzEZnJZg=; b=Lg0U0Y9cFBDgybBK7Ah0Mbb+7eKZS+BlEE5I+RRqZM6Tbds7/a6hEzv5LlhRxY3Q5n v6gv+yFqEHPVZT5nhdOdyqIcMH/cGJi1/ybnWQQnKdBEHsGlqNLiwGkTLsNQksP0KeI1 gnl11iz924aYWkEF006KhuvF5Xvm9nkqxRSXJQexVZB03xPdAPU4tjZDxTo1IORmrUso 8Oecvn5//Wv6hPDed1HeKtjtBCHa1HpN/6x1JXHuXETDA/ApiqV0h9yStc9F/125jf3Q M4O25gW34gNHfcF9DpEw2Ii5+H8UC5QHWfYwQ4gW8facKhDcp38yhwKhiSv0gfW1dJ/i oI+w== X-Gm-Message-State: AMke39nXNWJXc5dW6+ly1DB20S5vb8iSAFZQ4i/9UBHQb3abA5C/VbcqAWtdDN4o+yi6TQ== X-Received: by 10.55.27.68 with SMTP id b65mr24003304qkb.64.1487181339941; Wed, 15 Feb 2017 09:55:39 -0800 (PST) Received: from localhost.localdomain ([187.64.235.185]) by smtp.gmail.com with ESMTPSA id f128sm2733329qkb.3.2017.02.15.09.55.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Feb 2017 09:55:39 -0800 (PST) From: Gustavo Padovan To: linux-media@vger.kernel.org Cc: Gustavo Padovan , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/6] [media] vb2: only check ret if we assigned it Date: Wed, 15 Feb 2017 15:55:28 -0200 Message-Id: <20170215175533.6384-1-gustavo@padovan.org> X-Mailer: git-send-email 2.9.3 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan Move the ret check to the right level under if (pb). It is not used by the code before that point if pb is NULL. Signed-off-by: Gustavo Padovan --- drivers/media/v4l2-core/videobuf2-core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7c1d390..94afbbf9 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -984,11 +984,12 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const void *pb) memset(planes, 0, sizeof(planes[0]) * vb->num_planes); /* Copy relevant information provided by the userspace */ - if (pb) + if (pb) { ret = call_bufop(vb->vb2_queue, fill_vb2_buffer, vb, pb, planes); - if (ret) - return ret; + if (ret) + return ret; + } for (plane = 0; plane < vb->num_planes; ++plane) { /* Skip the plane if already verified */ @@ -1101,11 +1102,12 @@ static int __qbuf_dmabuf(struct vb2_buffer *vb, const void *pb) memset(planes, 0, sizeof(planes[0]) * vb->num_planes); /* Copy relevant information provided by the userspace */ - if (pb) + if (pb) { ret = call_bufop(vb->vb2_queue, fill_vb2_buffer, vb, pb, planes); - if (ret) - return ret; + if (ret) + return ret; + } for (plane = 0; plane < vb->num_planes; ++plane) { struct dma_buf *dbuf = dma_buf_get(planes[plane].m.fd);