From patchwork Sun Aug 19 17:44:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 1344621 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id EE3CBDF264 for ; Sun, 19 Aug 2012 17:44:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1T39Y1-0003vf-Ld; Sun, 19 Aug 2012 17:44:25 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1T39Y0-0003vZ-EY for spi-devel-general@lists.sourceforge.net; Sun, 19 Aug 2012 17:44:24 +0000 X-ACL-Warn: Received: from mail.active-venture.com ([67.228.131.205]) by sog-mx-1.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1T39Xz-0002mw-IO for spi-devel-general@lists.sourceforge.net; Sun, 19 Aug 2012 17:44:24 +0000 Received: (qmail 32965 invoked by uid 399); 19 Aug 2012 17:44:18 -0000 X-Virus-Scan: Scanned by ClamAV 0.97.2 (no viruses); Sun, 19 Aug 2012 12:44:18 -0500 Received: from unknown (HELO localhost) (guenter@roeck-us.net@108.223.40.66) by mail.active-venture.com with ESMTPAM; 19 Aug 2012 17:44:17 -0000 X-Originating-IP: 108.223.40.66 X-Sender: guenter@roeck-us.net From: Guenter Roeck To: spi-devel-general@lists.sourceforge.net Subject: [PATCH] spi/pl022: Fix device remove function Date: Sun, 19 Aug 2012 10:44:17 -0700 Message-Id: <1345398258-4153-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 1.7.9.7 X-Spam-Score: 0.9 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 1.6 RCVD_IN_BRBL_LASTEXT RBL: RCVD_IN_BRBL_LASTEXT [67.228.131.205 listed in bb.barracudacentral.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.7 AWL AWL: From: address is in the auto white-list X-Headers-End: 1T39Xz-0002mw-IO Cc: Mark Brown , Guenter Roeck X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net The call sequence spi_alloc_master/spi_register_master/spi_unregister_master is complete; it reduces the device reference count to zero, which results in device memory being freed. An extra call to spi_master_put is unnecessary and results in an access to free memory. Drop it. Signed-off-by: Guenter Roeck --- drivers/spi/spi-pl022.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index aab518e..47c6753 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -2171,7 +2171,6 @@ pl022_remove(struct amba_device *adev) amba_release_regions(adev); tasklet_disable(&pl022->pump_transfers); spi_unregister_master(pl022->master); - spi_master_put(pl022->master); amba_set_drvdata(adev, NULL); return 0; }