From patchwork Tue Nov 22 07:01:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanchayan X-Patchwork-Id: 9440569 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C906F600BA for ; Tue, 22 Nov 2016 07:13:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB5092844B for ; Tue, 22 Nov 2016 07:13:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B01E328468; Tue, 22 Nov 2016 07:13:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5F4B82844B for ; Tue, 22 Nov 2016 07:13:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c95F9-0005sO-C8; Tue, 22 Nov 2016 07:11:51 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c95EO-0005FR-Cw for linux-arm-kernel@lists.infradead.org; Tue, 22 Nov 2016 07:11:05 +0000 Received: by mail-pg0-x244.google.com with SMTP id e9so1248311pgc.1 for ; Mon, 21 Nov 2016 23:10:44 -0800 (PST) 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 :in-reply-to:references; bh=dkyRqfJUzwwcwPvBinbzqGcqTEwcoOM+GyyZFGf2WEY=; b=j5MqB1E50i9VcBoDh3j66an6H1MNOJl1utbhnADUnrN5JotY90H8AI9AcyTkf9Qcg+ SVSf2fZ5jrv5ENpmEz5e2Xvnst2/Hu9QOXS0IHA52qYpRkzrkZ2Ioio9W5n+9d0aLWzQ R09UZEcau8b0ZJ118gQOpGlA85gknZi6E48TsI7xotWY5dH275qhCApyZdhClZWWK2co YhIoDR9UYRgSRCE5kNBSRe73NCmF1gek1+EOmS+KJr4lPsqHeqsfYOn4Jf7NNmNZRvE9 PhSoklqlMz3lm/5qO9G7rL9ZoG4nbyGZEzdOcbZNvWFf+5Sbi1jgF7bLz3addtpx6Xwe EJDg== 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:in-reply-to:references; bh=dkyRqfJUzwwcwPvBinbzqGcqTEwcoOM+GyyZFGf2WEY=; b=Sv/LGB8evB85+rrl7N0B9f6r4WuvUXD1dJ+bpnHHoLkJHOVn56o6HQUjff8MDdZIZY wd2a3qhnEoHJBnOHowWorohedRg+GW6NxfLN8uz2iYOBXyGeX+OYC6o3hR3DQBr4azzE z/0ahaj7yOgBn+WEloEvExGxkMl2pQUqG49ikyCsyGJ0s4jLNdfjvMVvoMJL+slz9P+O 8rYV6OtJdlGsHJi4VqyhrbeJOKJMhiNmqgjGW+iLEE/DH+dLEkl4go6KN7o0XqEugNt8 04/5scsg1CEWg6pZZAN+FalsNB4uh7IKOXvD3RDsS7YPQHsMFKV/Q23XCnD/WJ/4jYM2 JXDg== X-Gm-Message-State: AKaTC00DA/tLeoTfMPfAwsY3YBN6LfYez4kS0sG4waqll93XXwxL/Np2GGlvMx2c1Y58UA== X-Received: by 10.99.166.2 with SMTP id t2mr20911770pge.40.1479798643812; Mon, 21 Nov 2016 23:10:43 -0800 (PST) Received: from localhost ([115.115.243.34]) by smtp.gmail.com with ESMTPSA id s2sm42293926pfi.10.2016.11.21.23.10.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Nov 2016 23:10:43 -0800 (PST) From: Sanchayan Maity To: broonie@kernel.org Subject: [PATCH v3 3/3] spi: spi-fsl-dspi: Fix incorrect freeing of DMA allocated buffers Date: Tue, 22 Nov 2016 12:31:32 +0530 Message-Id: X-Mailer: git-send-email 2.10.2 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161121_231104_694592_A6567ED2 X-CRM114-Status: UNSURE ( 9.86 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sanchayan Maity , linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, stefan@agner.ch, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Buffers allocated with a call to dma_alloc_coherent should be freed with dma_free_coherent instead of the currently used devm_kfree. Signed-off-by: Sanchayan Maity --- drivers/spi/spi-fsl-dspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 8af3151..7ada112 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -420,9 +420,11 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) return 0; err_slave_config: - devm_kfree(dev, dma->rx_dma_buf); + dma_free_coherent(dev, DSPI_DMA_BUFSIZE, + dma->rx_dma_buf, dma->rx_dma_phys); err_rx_dma_buf: - devm_kfree(dev, dma->tx_dma_buf); + dma_free_coherent(dev, DSPI_DMA_BUFSIZE, + dma->tx_dma_buf, dma->tx_dma_phys); err_tx_dma_buf: dma_release_channel(dma->chan_tx); err_tx_channel: