From patchwork Sun Mar 23 06:37:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 3878861 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 723EB9F2E8 for ; Sun, 23 Mar 2014 06:38:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5253E202EA for ; Sun, 23 Mar 2014 06:38:55 +0000 (UTC) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73246202DD for ; Sun, 23 Mar 2014 06:38:54 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2N6c0uT027629; Sun, 23 Mar 2014 01:38:00 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2N6c0eW023570; Sun, 23 Mar 2014 01:38:00 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Sun, 23 Mar 2014 01:37:59 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2N6bwap022971; Sun, 23 Mar 2014 01:37:58 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id B1FEB8062A; Sun, 23 Mar 2014 00:37:58 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflxv17.itg.ti.com (dflxv17.itg.ti.com [128.247.5.93]) by linux.omap.com (Postfix) with ESMTP id 537618062A for ; Sun, 23 Mar 2014 00:37:55 -0600 (CST) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dflxv17.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2N6bt0k023400 for ; Sun, 23 Mar 2014 01:37:55 -0500 Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2N6bsfA018940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 23 Mar 2014 01:37:55 -0500 Received: from [216.82.253.67:46542] by server-1.bemta-7.messagelabs.com id 80/20-20943-2418E235; Sun, 23 Mar 2014 06:37:54 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-14.tower-158.messagelabs.com!1395556673!3649099!1 X-Originating-IP: [209.85.160.51] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9444 invoked from network); 23 Mar 2014 06:37:54 -0000 Received: from mail-pb0-f51.google.com (HELO mail-pb0-f51.google.com) (209.85.160.51) by server-14.tower-158.messagelabs.com with RC4-SHA encrypted SMTP; 23 Mar 2014 06:37:54 -0000 Received: by mail-pb0-f51.google.com with SMTP id uo5so4083890pbc.24 for ; Sat, 22 Mar 2014 23:37: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=vWuJwUMdnc+LW8mVBsXBf+0fa9n9r0BOi3xP32cNt7k=; b=ckXIk7hA2pml5+h6CJKcCKA9cNZMA1v7/01JFuvGamylXMHwdgNFZvMt7eFxo45cwc Kzhe9MkuAdTVeyZ4V1QjKI96aq7BYzGeIaiNCDwOlLHTzbDxk9ebUUYWK1I3TZjwh/T3 6awNNaKxt0Eos8wvJ2Bn43ms8lICeAa7s9SMlGEXGFFc8QrXJwdF4a6Pa6LuShSAU+CW 2/lz9JISMG6ENtnwRm6keUgYq4zatQvyIa52RuSAIO3EOexkcyqouHwr5zyIyCHJtEOh MmWJ8kiRX+UhPvGBdcWUFuyhaS3Rre8BXUUlFrtLW/zWkYDfVWVtSMJzVwEg/BuzHKMm D28w== X-Received: by 10.68.99.194 with SMTP id es2mr64691810pbb.100.1395556673532; Sat, 22 Mar 2014 23:37:53 -0700 (PDT) Received: from localhost.localdomain ([49.201.250.179]) by mx.google.com with ESMTPSA id qw8sm19388994pbb.27.2014.03.22.23.37.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Mar 2014 23:37:52 -0700 (PDT) From: "Lad, Prabhakar" To: LMML Subject: [PATCH 2/2] staging: media: davinci: vpfe: release buffers in case start_streaming call back fails Date: Sun, 23 Mar 2014 12:07:25 +0530 Message-ID: <1395556645-1207-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1395556645-1207-1-git-send-email-prabhakar.csengg@gmail.com> References: <1395556645-1207-1-git-send-email-prabhakar.csengg@gmail.com> CC: , DLOS , Greg Kroah-Hartman , LKML , Mauro Carvalho Chehab 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=ham 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: "Lad, Prabhakar" this patch releases the buffer bu calling vb2_buffer_done(), with state marked as VB2_BUF_STATE_QUEUED if start_streaming() call back fails. Signed-off-by: Lad, Prabhakar --- drivers/staging/media/davinci_vpfe/vpfe_video.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index c86ab84..9337d92 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -1218,8 +1218,16 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count) video->state = VPFE_VIDEO_BUFFER_QUEUED; ret = vpfe_start_capture(video); - if (ret) + if (ret) { + struct vpfe_cap_buffer *buf, *tmp; + + vb2_buffer_done(&video->cur_frm->vb, VB2_BUF_STATE_QUEUED); + list_for_each_entry_safe(buf, tmp, &video->dma_queue, list) { + list_del(&buf->list); + vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); + } goto unlock_out; + } mutex_unlock(&video->lock);