From patchwork Fri Nov 15 07:54:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 3187071 Return-Path: X-Original-To: patchwork-linux-arm@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 76249C045B for ; Fri, 15 Nov 2013 07:54:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6A4720994 for ; Fri, 15 Nov 2013 07:54:53 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1E8C20986 for ; Fri, 15 Nov 2013 07:54:52 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhEEn-0003JA-Ix; Fri, 15 Nov 2013 07:54:45 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhEEl-0000Fh-9f; Fri, 15 Nov 2013 07:54:43 +0000 Received: from mail-bk0-x234.google.com ([2a00:1450:4008:c01::234]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VhEEh-0000Et-KH for linux-arm-kernel@lists.infradead.org; Fri, 15 Nov 2013 07:54:40 +0000 Received: by mail-bk0-f52.google.com with SMTP id u14so1340648bkz.25 for ; Thu, 14 Nov 2013 23:54:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=f/n/ygogDbwZdCYeTR2LLt4R27B33tUO63qEL36QgYc=; b=OBvM8wsH+s17aokkWuLMGl5wyn5n8dJ1nSBghqUDS9uZ1BulC087oZeX1OXmA18YgK imgR3eY295TgmA8+y1MRb+XDLwHkCeZ8Ocj4008XFInay4texJXwrUohBlZxG+oEQfsN 7xsItje7Gydl9sODmphYmoNvQqDltgu3pd54/1PdX4UQsgyDpTE5LIzF2FdSN3m/mnlg 4rLwaCIkx/JbqXtBAUhcwQPHjzYRDFmzvSlPsBveKU5hNDiDH7Pcf1/EaHi86ssNqGp2 lyqyMUQRA6dgsKtLv9aQmETGxMKPJdtE0GNbQQob3Q1KoFLUVnM+ScOrBW8fxSKbPLoO Uq1Q== MIME-Version: 1.0 X-Received: by 10.205.10.132 with SMTP id pa4mr3414154bkb.15.1384502056681; Thu, 14 Nov 2013 23:54:16 -0800 (PST) Received: by 10.204.74.130 with HTTP; Thu, 14 Nov 2013 23:54:16 -0800 (PST) Date: Fri, 15 Nov 2013 15:54:16 +0800 Message-ID: Subject: [PATCH] spi: s3c64xx: fix reference leak to master in s3c64xx_spi_remove() From: Wei Yongjun To: ben-linux@fluff.org, kgene.kim@samsung.com, broonie@kernel.org, grant.likely@linaro.org, rob.herring@calxeda.com, jg1.han@samsung.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131115_025439_820203_E4C7AAA6 X-CRM114-Status: UNSURE ( 9.93 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) Cc: yongjun_wei@trendmicro.com.cn, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Wei Yongjun Once a spi_master_get() call succeeds, we need an additional spi_master_put() call to free the memory, otherwise we will leak a reference to master. Fix by removing the unnecessary spi_master_get() call. Signed-off-by: Wei Yongjun --- drivers/spi/spi-s3c64xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 9e2020d..9c82d7b 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1439,7 +1439,7 @@ err0: static int s3c64xx_spi_remove(struct platform_device *pdev) { - struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); + struct spi_master *master = platform_get_drvdata(pdev); struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); pm_runtime_disable(&pdev->dev);