From patchwork Sun Oct 12 20:40:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 5071871 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7BE769F1EE for ; Sun, 12 Oct 2014 20:43:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6605201B4 for ; Sun, 12 Oct 2014 20:43:56 +0000 (UTC) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B10C520176 for ; Sun, 12 Oct 2014 20:43:55 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9CKgvFp011118; Sun, 12 Oct 2014 15:42:57 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9CKgvJI014551; Sun, 12 Oct 2014 15:42:57 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Sun, 12 Oct 2014 15:42:56 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9CKguol022366; Sun, 12 Oct 2014 15:42:56 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 2CA6A80627; Sun, 12 Oct 2014 15:42:56 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlelxv84.itg.ti.com (dlelxv84.itg.ti.com [172.17.0.246]) by linux.omap.com (Postfix) with ESMTP id B3C0380626 for ; Sun, 12 Oct 2014 15:41:03 -0500 (CDT) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dlelxv84.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9CKf31e026919 for ; Sun, 12 Oct 2014 15:41:03 -0500 Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9CKf0Yt004505 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 12 Oct 2014 15:41:02 -0500 Received: from [216.82.241.195:9720] by server-5.bemta-8.messagelabs.com id 9A/03-05345-C57EA345; Sun, 12 Oct 2014 20:41:00 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-9.tower-119.messagelabs.com!1413146458!30628701!1 X-Originating-IP: [209.85.212.174] X-SpamReason: No, hits=0.2 required=7.0 tests=RCVD_ILLEGAL_IP X-StarScan-Received: X-StarScan-Version: 6.12.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31441 invoked from network); 12 Oct 2014 20:40:59 -0000 Received: from mail-wi0-f174.google.com (HELO mail-wi0-f174.google.com) (209.85.212.174) by server-9.tower-119.messagelabs.com with RC4-SHA encrypted SMTP; 12 Oct 2014 20:40:59 -0000 Received: by mail-wi0-f174.google.com with SMTP id h11so2091448wiw.7 for ; Sun, 12 Oct 2014 13:40:58 -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=BUuABKd9/GIxEAFqTcpBXhwOMu3lNzcSTSy7O3vh6Wc=; b=hTUgU02YuHK3j307oN/MBCtObs5AG+uzrfV/EpfWKGKMmsHSFHwd/kWO1kxNUQqLue teQ4PZ6EiLPuMTHiIua+UKyccpyqA3g5Apbt9L9ZftiSkQGmf36JfWqoH6uf6MXARvhX qWFJt4KDkj+xh6VuseL0SA/Cgzg3hEQ1il07zJwEvU1ZD4t0TJ8DBYJqazoietUXnMk1 GVZmdoFaAIrCaRPoj1eCYyilb9ATF1GTT7LIo6wVRayfOMMte2PEpJFjZf97XV8emNFX cRdo8+d5XDZpvH8Y64FZkShZEKqsg9agh+ibcptxcKR7BEBUJWKAOb0yCWciLgiWSKo9 ARbQ== X-Received: by 10.180.182.79 with SMTP id ec15mr16138698wic.14.1413146458473; Sun, 12 Oct 2014 13:40:58 -0700 (PDT) Received: from tango-charlie.Home ([2.127.193.40]) by mx.google.com with ESMTPSA id y5sm9970930wix.10.2014.10.12.13.40.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 12 Oct 2014 13:40:57 -0700 (PDT) From: "Lad, Prabhakar" To: LMML Subject: [PATCH 05/15] media: davinci: vpbe: improve vpbe_buffer_prepare() callback Date: Sun, 12 Oct 2014 21:40:35 +0100 Message-ID: <1413146445-7304-6-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413146445-7304-1-git-send-email-prabhakar.csengg@gmail.com> References: <1413146445-7304-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , LKML X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com 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, 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 this patch improve vpbe_buffer_prepare() callback, as buf_prepare() callback is never called with invalid state and check for vb2_plane_vaddr(vb, 0) is dropped as payload check should be done unconditionally. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpbe_display.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 491b832..524e1fd 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -215,22 +215,15 @@ static int vpbe_buffer_prepare(struct vb2_buffer *vb) v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_buffer_prepare\n"); - if (vb->state != VB2_BUF_STATE_ACTIVE && - vb->state != VB2_BUF_STATE_PREPARED) { - vb2_set_plane_payload(vb, 0, layer->pix_fmt.sizeimage); - if (vb2_plane_vaddr(vb, 0) && - vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) - return -EINVAL; + vb2_set_plane_payload(vb, 0, layer->pix_fmt.sizeimage); + if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) + return -EINVAL; - addr = vb2_dma_contig_plane_dma_addr(vb, 0); - if (q->streaming) { - if (!IS_ALIGNED(addr, 8)) { - v4l2_err(&vpbe_dev->v4l2_dev, - "buffer_prepare:offset is \ - not aligned to 32 bytes\n"); - return -EINVAL; - } - } + addr = vb2_dma_contig_plane_dma_addr(vb, 0); + if (!IS_ALIGNED(addr, 8)) { + v4l2_err(&vpbe_dev->v4l2_dev, + "buffer_prepare:offset is not aligned to 32 bytes\n"); + return -EINVAL; } return 0; }