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: 9440561 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 0DD48600BA for ; Tue, 22 Nov 2016 07:11:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0182D2844B for ; Tue, 22 Nov 2016 07:11:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA99928462; Tue, 22 Nov 2016 07:11:10 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3E412846B for ; Tue, 22 Nov 2016 07:11:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755024AbcKVHKq (ORCPT ); Tue, 22 Nov 2016 02:10:46 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:34147 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755009AbcKVHKo (ORCPT ); Tue, 22 Nov 2016 02:10:44 -0500 Received: by mail-pg0-f66.google.com with SMTP id e9so1248309pgc.1; 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=OXErnT41tjGLQwkujUDkWjQbIv3ZmXTWmVQY0pGrmI3f3Pi1tUh6mvJpHgftIsxmm5 tosdvY9P6/VDIMLfO40GgX2G6EhrgPDnZnUfy6lbUkl5JEZS7rkEWJvjkeYPOWiI4CXf DhqODUpOZbdLy8ewgf4olRnUQFPa9gUgTeMTYX2CrLpH2fdIXRHehPMRp9dYMop4Tco7 m0z9mkTzQBb1ZqjWJXq94Nkl8KwFo1kvbxzO6m7hBRrr/X6++By1c0TP6NnmVV2ozkX2 8ww7yZWEEBwj0Wj7rAqLLaPwOKVdnJx6QqNpENjfrMyuOYZP+xi6gS1d6z/FPI1wzDY5 ampA== X-Gm-Message-State: AKaTC03chwzVJD/QdC1v5lCX9kR4T3C1m2ToH5C922mIedcglRjJ/5x7WANydqau0Rk1Dw== 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 Cc: stefan@agner.ch, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Sanchayan Maity 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: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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: