From patchwork Tue Jul 12 11:08:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: weiyj_lk@163.com X-Patchwork-Id: 9225079 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 5C242604DB for ; Tue, 12 Jul 2016 11:09:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D31D265F9 for ; Tue, 12 Jul 2016 11:09:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41B7B27F46; Tue, 12 Jul 2016 11:09:24 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 C1536265F9 for ; Tue, 12 Jul 2016 11:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753467AbcGLLJX (ORCPT ); Tue, 12 Jul 2016 07:09:23 -0400 Received: from m12-15.163.com ([220.181.12.15]:33961 "EHLO m12-15.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751678AbcGLLJW (ORCPT ); Tue, 12 Jul 2016 07:09:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=ZEEPy AQMACZXLJLF3LQebVi1p7JKIa0fk/VafHdTyx4=; b=NYgx6IRhzy069AZ+yHU7S zw2DzVVDibeU28RbljPJFQmvyt6XqYll2RYik76MTiGTI/eTwORg1TbgMtbdGrjF ATMBOc/AghIPfhIiMRxaitLQngXZDR3gsgeC+XAQqb8TPqvP+1tEBJyNaiyZ2xzx iP1quq1uHeU2wYnoMr8QUU= Received: from localhost.localdomain.localdomain (unknown [180.110.253.144]) by smtp11 (Coremail) with SMTP id D8CowAD3ndK6z4RXchruCw--.36026S2; Tue, 12 Jul 2016 19:08:43 +0800 (CST) From: weiyj_lk@163.com To: Kukjin Kim , Krzysztof Kozlowski , Mark Brown Cc: Wei Yongjun , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-spi@vger.kernel.org Subject: [PATCH -next] spi: s3c64xx: fix reference leak to master in s3c64xx_spi_remove() Date: Tue, 12 Jul 2016 11:08:42 +0000 Message-Id: <1468321722-16568-1-git-send-email-weiyj_lk@163.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-CM-TRANSID: D8CowAD3ndK6z4RXchruCw--.36026S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr4DuFy8tFW5AF43Gw18uFg_yoWfKrgEkr 4rWF1xKr45XrZIyF1j9r1fZayaqFW5Xr10gF4v93yfXayDArW5ZrnxXayDGF1DZws0yF9I yrn8Kr95Ar93tjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUnTqcUUUUUU== X-Originating-IP: [180.110.253.144] X-CM-SenderInfo: pzhl5yxbonqiywtou0bp/1tbioxuk1lUL7RaodgAAsx 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 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 Reviewed-by: Andi Shyti --- drivers/spi/spi-s3c64xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-spi" 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 df88fa1..001c9eb 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -1211,7 +1211,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_get_sync(&pdev->dev);