From patchwork Fri Jan 13 07:42:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9514767 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 46E07601DA for ; Fri, 13 Jan 2017 07:44:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33657284D0 for ; Fri, 13 Jan 2017 07:44:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 150C6285E8; Fri, 13 Jan 2017 07:44:02 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 93E02284D0 for ; Fri, 13 Jan 2017 07:44:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751191AbdAMHn7 (ORCPT ); Fri, 13 Jan 2017 02:43:59 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:29250 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbdAMHn5 (ORCPT ); Fri, 13 Jan 2017 02:43:57 -0500 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v0D7h6H8032406 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2017 07:43:06 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v0D7h51B001333 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2017 07:43:05 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v0D7h4oJ008455; Fri, 13 Jan 2017 07:43:04 GMT Received: from mwanda (/154.0.138.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 12 Jan 2017 23:43:03 -0800 Date: Fri, 13 Jan 2017 10:42:53 +0300 From: Dan Carpenter To: Kukjin Kim , Marek Szyprowski Cc: Krzysztof Kozlowski , Javier Martinez Canillas , Andi Shyti , Mark Brown , linux-samsung-soc@vger.kernel.org, linux-spi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] spi: s3c64xx: potential oops on probe error Message-ID: <20170113074253.GA30524@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.0 (2016-04-01) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We accidentally mixed up freeing the rx and tx channels which would a leak and an oops. Fixes: 3d63a47a380a ("spi: s3c64xx: Don't request/release DMA channels for each SPI transfer") Signed-off-by: Dan Carpenter Acked-by: Marek Szyprowski Acked-by: Andi Shyti --- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 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/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 849ee82..b8cd356 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1147,7 +1147,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) if (IS_ERR(sdd->tx_dma.ch)) { dev_err(&pdev->dev, "Failed to get TX DMA channel\n"); ret = PTR_ERR(sdd->tx_dma.ch); - goto err_release_tx_dma; + goto err_release_rx_dma; } } @@ -1197,10 +1197,10 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) pm_runtime_set_suspended(&pdev->dev); if (!is_polling(sdd)) - dma_release_channel(sdd->rx_dma.ch); -err_release_tx_dma: - if (!is_polling(sdd)) dma_release_channel(sdd->tx_dma.ch); +err_release_rx_dma: + if (!is_polling(sdd)) + dma_release_channel(sdd->rx_dma.ch); err_disable_io_clk: clk_disable_unprepare(sdd->ioclk); err_disable_src_clk: