From patchwork Mon Jun 16 03:32:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolin Chen X-Patchwork-Id: 4355901 X-Patchwork-Delegate: vinod.koul@intel.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1F783BEEAA for ; Mon, 16 Jun 2014 03:30:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 472D220260 for ; Mon, 16 Jun 2014 03:30:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 77D3E2020E for ; Mon, 16 Jun 2014 03:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753004AbaFPDac (ORCPT ); Sun, 15 Jun 2014 23:30:32 -0400 Received: from mail-bn1blp0181.outbound.protection.outlook.com ([207.46.163.181]:3447 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752787AbaFPDab (ORCPT ); Sun, 15 Jun 2014 23:30:31 -0400 Received: from BY2PR03CA033.namprd03.prod.outlook.com (10.242.234.154) by BY2PR03MB394.namprd03.prod.outlook.com (10.141.141.13) with Microsoft SMTP Server (TLS) id 15.0.954.9; Mon, 16 Jun 2014 03:30:28 +0000 Received: from BY2FFO11FD009.protection.gbl (2a01:111:f400:7c0c::145) by BY2PR03CA033.outlook.office365.com (2a01:111:e400:2c2c::26) with Microsoft SMTP Server (TLS) id 15.0.959.24 via Frontend Transport; Mon, 16 Jun 2014 03:30:28 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD009.mail.protection.outlook.com (10.1.14.73) with Microsoft SMTP Server (TLS) id 15.0.959.15 via Frontend Transport; Mon, 16 Jun 2014 03:30:28 +0000 Received: from rio.ap.freescale.net (rio.ap.freescale.net [10.192.242.9]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s5G3UOGs029692; Sun, 15 Jun 2014 20:30:25 -0700 From: Nicolin Chen To: , CC: , , Subject: [PATCH] dma: imx-sdma: Save imx_dma_data into sdmac Date: Mon, 16 Jun 2014 11:32:29 +0800 Message-ID: <1402889549-23864-1-git-send-email-nicoleotsuka@gmail.com> X-Mailer: git-send-email 1.8.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 130473630281563195; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199002)(189002)(62966002)(73972005)(92726001)(80022001)(48376002)(82202001)(86362001)(47776003)(87286001)(61266001)(104166001)(50466002)(85306003)(74502001)(87936001)(31966008)(97736001)(21056001)(36756003)(84676001)(87572001)(85852003)(73392001)(6806004)(33646001)(68736004)(77156001)(77982001)(55446002)(93916002)(89996001)(46102001)(83072002)(102836001)(4396001)(74662001)(19580395003)(44976005)(81542001)(92566001)(20776003)(99396002)(64706001)(26826002)(88136002)(50226001)(79102001)(50986999)(81342001)(19580405001)(104016001)(81442001); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR03MB394; H:tx30smr01.am.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BL:0; ACTION:Default; RISK:Low; SCL:0; SPMLVL:NotSpam; PCL:0; RULEID: X-Forefront-PRVS: 0244637DEA Received-SPF: SoftFail (: domain of transitioning gmail.com discourages use of 192.88.168.50 as permitted sender) Authentication-Results: spf=softfail (sender IP is 192.88.168.50) smtp.mailfrom=nicoleotsuka@gmail.com; Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,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 The filter() function is currently called by xlate() while it transfers imx_dma_data as a local variable to the filter() but releases the data right after returning a DMA channel pointer, which results chan->private pointing an invalid memory space. So this patch just stores the imx_dma_data into sdmac to make usre the private pointer valid as long as the channel exists. Signed-off-by: Nicolin Chen --- drivers/dma/imx-sdma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 19041ce..fc04add 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -270,6 +270,7 @@ struct sdma_channel { unsigned int chn_count; unsigned int chn_real_count; struct tasklet_struct tasklet; + struct imx_dma_data data; }; #define IMX_DMA_SG_LOOP BIT(0) @@ -1402,12 +1403,14 @@ err_dma_alloc: static bool sdma_filter_fn(struct dma_chan *chan, void *fn_param) { + struct sdma_channel *sdmac = to_sdma_chan(chan); struct imx_dma_data *data = fn_param; if (!imx_dma_is_general_purpose(chan)) return false; - chan->private = data; + sdmac->data = *data; + chan->private = &sdmac->data; return true; }