From patchwork Wed Feb 17 00:40:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guzman Lugo, Fernando" X-Patchwork-Id: 79814 X-Patchwork-Delegate: omar.ramirez@ti.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1H0dSCC026447 for ; Wed, 17 Feb 2010 00:40:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933772Ab0BQAkU (ORCPT ); Tue, 16 Feb 2010 19:40:20 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:43997 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933615Ab0BQAkS convert rfc822-to-8bit (ORCPT ); Tue, 16 Feb 2010 19:40:18 -0500 Received: from dlep34.itg.ti.com ([157.170.170.115]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o1H0eETW027306 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Feb 2010 18:40:14 -0600 Received: from dlep26.itg.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id o1H0eDI1015740; Tue, 16 Feb 2010 18:40:13 -0600 (CST) Received: from dsbe71.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id o1H0eDel013516; Tue, 16 Feb 2010 18:40:13 -0600 (CST) Received: from dlee06.ent.ti.com ([157.170.170.11]) by dsbe71.ent.ti.com ([156.117.232.23]) with mapi; Tue, 16 Feb 2010 18:40:13 -0600 From: "Guzman Lugo, Fernando" To: linux-omap CC: "Ramirez Luna, Omar" , Hiroshi Doyu , Ameya Palande , Felipe Contreras Date: Tue, 16 Feb 2010 18:40:13 -0600 Subject: [PATCH 2/2] DSPBRIDGE: Reclaim all pending buffer on resource cleanup Thread-Topic: [PATCH 2/2] DSPBRIDGE: Reclaim all pending buffer on resource cleanup Thread-Index: AcqvacQkMKVl2OtMSGOrBhJyzm5j/g== Message-ID: <496565EC904933469F292DDA3F1663E602CA2B9606@dlee06.ent.ti.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 17 Feb 2010 00:40:21 +0000 (UTC) diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c index 505f2b0..5a394da 100644 --- a/drivers/dsp/bridge/rmgr/drv.c +++ b/drivers/dsp/bridge/rmgr/drv.c @@ -461,6 +461,8 @@ DSP_STATUS DRV_RemoveAllSTRMResElements(HANDLE hPCtxt) DSP_STATUS status = DSP_SOK; struct STRM_RES_OBJECT *strm_res = NULL; struct STRM_RES_OBJECT *strm_tmp = NULL; + struct STRM_INFO strm_info; + struct DSP_STREAMINFO user; u8 **apBuffer = NULL; u8 *pBufPtr; u32 ulBytes; @@ -474,17 +476,19 @@ DSP_STATUS DRV_RemoveAllSTRMResElements(HANDLE hPCtxt) if (strm_res->uNumBufs) { apBuffer = MEM_Alloc((strm_res->uNumBufs * sizeof(u8 *)), MEM_NONPAGED); - status = STRM_FreeBuffer(strm_res->hStream, apBuffer, - strm_res->uNumBufs, pCtxt); - kfree(apBuffer); + if (apBuffer) { + status = STRM_FreeBuffer(strm_res->hStream, + apBuffer, strm_res->uNumBufs, pCtxt); + kfree(apBuffer); + } } + strm_info.pUser = &user; + user.uNumberBufsInStream = 0; + STRM_GetInfo(strm_res->hStream, &strm_info, sizeof(strm_info)); + while (user.uNumberBufsInStream--) + STRM_Reclaim(strm_res->hStream, &pBufPtr, &ulBytes, + (u32 *)&ulBufSize, &dwArg); status = STRM_Close(strm_res->hStream, pCtxt); - if (status == DSP_EPENDING) { - status = STRM_Reclaim(strm_res->hStream, - &pBufPtr, &ulBytes, (u32 *)&ulBufSize, &dwArg); - if (DSP_SUCCEEDED(status)) - status = STRM_Close(strm_res->hStream, pCtxt); - } } return status; }