From patchwork Mon Apr 11 08:38:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 65475 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp1338223lbl; Mon, 11 Apr 2016 01:39:36 -0700 (PDT) X-Received: by 10.66.132.103 with SMTP id ot7mr31250802pab.27.1460363972006; Mon, 11 Apr 2016 01:39:32 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kk8si2325150pab.26.2016.04.11.01.39.31; Mon, 11 Apr 2016 01:39:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753225AbcDKIjW (ORCPT + 7 others); Mon, 11 Apr 2016 04:39:22 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:34547 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753299AbcDKIjS (ORCPT ); Mon, 11 Apr 2016 04:39:18 -0400 Received: by mail-wm0-f44.google.com with SMTP id l6so135701105wml.1 for ; Mon, 11 Apr 2016 01:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BdBIFej2t9sSqYTveiYJBXX2rqQpDcqlkEf1MdXU2QY=; b=a3BqGuJRhjucB5Km64KRtJLIfbf0X3OcZgFEszJl4gn568dqzfSbjvbfymyQtirgCi vZsbl63aj5cFIkh63J3xycS53bR2Nl0xoceKadKy4RbiXLsuLuNPG9b+rgHH9WkOfiki Bad0eXrmligVJNXhdLHr/wOyosoLkcgiOL9gE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BdBIFej2t9sSqYTveiYJBXX2rqQpDcqlkEf1MdXU2QY=; b=DgHlhsVP+AWgGiyYxqQNuNFXbwIszDI8aqX+VB3Ol0AaqQvpIOXgn9eb7PRoglXMDD EiGyBDI+4cKXbXgHDqkVMDDEKCK79lnnb5/g/56JMfXC4uTQZhdz1I5wuA2WvlQvpYNu D1zzne4iHG/fmmPg4hrj98UVOvtyLCeaQ+027XydKqLrhATf9WhFavNlFfVrJtDNmDwh NvmLiaq8dob7GqMZiQfvH21epW5tWaWkmN1mfgxmin59++vQcnuChWnc+jJZPTWX48m5 Y1x82VfwJJQQagSjA3S2+0SjFDco4RLMpKC/lO3OpZuDhqEAzhjB/5chukjmKzc2kOSK qOFg== X-Gm-Message-State: AD7BkJIAiDL2wULhecWQMXB4BFNvDderHEb0HXEn+zzFYMHU6OAKI+buokYQU7YmynWN1TCo X-Received: by 10.194.90.229 with SMTP id bz5mr24533037wjb.143.1460363956694; Mon, 11 Apr 2016 01:39:16 -0700 (PDT) Received: from mms734.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id d1sm16078604wmh.18.2016.04.11.01.39.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Apr 2016 01:39:16 -0700 (PDT) From: Stanimir Varbanov To: Rob Herring , Mark Rutland , Vinod Koul , Andy Gross Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, dmaengine@vger.kernel.org, Archit Taneja , Sinan Kaya , Pramod Gurav , Stanimir Varbanov Subject: [PATCH v3 1/6] dmaengine: qcom: bam_dma: fix dma free memory on remove Date: Mon, 11 Apr 2016 11:38:38 +0300 Message-Id: <1460363923-16296-2-git-send-email-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1460363923-16296-1-git-send-email-stanimir.varbanov@linaro.org> References: <1460363923-16296-1-git-send-email-stanimir.varbanov@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Building the driver as a module and when removing the already inserted module gives below: [ 1389.392788] Unable to handle kernel paging request at virtual address ffffffbdc000001c [ 1389.421321] pgd = ffffffc02fa87000 [ 1389.447899] [ffffffbdc000001c] *pgd=0000000000000000, *pud=0000000000000000 [ 1389.460142] Internal error: Oops: 96000006 [#1] PREEMPT SMP [ 1389.466963] Modules linked in: qcom_bam_dma(-) [ 1389.486608] CPU: 2 PID: 2442 Comm: rmmod Not tainted 4.2.0+ #407 [ 1389.493885] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT) [ 1389.501196] task: ffffffc035bae2c0 ti: ffffffc0368a8000 task.ti: ffffffc0368a8000 [ 1389.508566] PC is at __free_pages+0xc/0x40 [ 1389.515893] LR is at free_pages.part.93+0x30/0x38 [ 1389.523141] pc : [] lr : [] pstate: 80000145 [ 1389.530602] sp : ffffffc0368abc20 [ 1389.537931] x29: ffffffc0368abc20 x28: ffffffc0368a8000 [ 1389.549153] x27: 0000000000000000 x26: 0000000000000000 [ 1389.560412] x25: ffffffc000cb2000 x24: 0000000000000170 [ 1389.571530] x23: 0000000000000004 x22: ffffffc036bc5010 [ 1389.582721] x21: ffffffc036bc5010 x20: 0000000000000000 [ 1389.593981] x19: 0000000000000002 x18: 0000007fcbc8e8b0 [ 1389.605301] x17: 0000007f9b8226ec x16: ffffffc0002089e8 [ 1389.616647] x15: 0000007f9b8a0588 x14: 0ffffffffffffffc [ 1389.628039] x13: 0000000000000030 x12: 0000000000000000 [ 1389.639436] x11: 0000000000000008 x10: ffffffc000ecc000 [ 1389.650872] x9 : ffffffc035bae2c0 x8 : ffffffc035bae9a8 [ 1389.662367] x7 : ffffffc035bae9a0 x6 : 0000000000000000 [ 1389.673906] x5 : ffffffbdc000001c x4 : 0000000080000000 [ 1389.685475] x3 : ffffffbdc0000000 x2 : 0000004080000000 [ 1389.697049] x1 : 0000000000000003 x0 : ffffffbdc0000000 The memory has been already freed by bam_free_chan() so fix this by skiping already freed memory. Signed-off-by: Stanimir Varbanov --- drivers/dma/qcom/bam_dma.c | 3 +++ 1 file changed, 3 insertions(+) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index d5e0a9c3ad5d..a486bc0f82e0 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -1234,6 +1234,9 @@ static int bam_dma_remove(struct platform_device *pdev) bam_dma_terminate_all(&bdev->channels[i].vc.chan); tasklet_kill(&bdev->channels[i].vc.task); + if (!bdev->channels[i].fifo_virt) + continue; + dma_free_wc(bdev->dev, BAM_DESC_FIFO_SIZE, bdev->channels[i].fifo_virt, bdev->channels[i].fifo_phys);