From patchwork Fri Apr 16 09:52:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Tereshonkov X-Patchwork-Id: 93092 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3G9rSnK001708 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 16 Apr 2010 09:54:08 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1O2iEl-0004yn-4h; Fri, 16 Apr 2010 09:53:23 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1O2iEk-0004yd-8t for spi-devel-general@lists.sourceforge.net; Fri, 16 Apr 2010 09:53:22 +0000 Received-SPF: pass (sfi-mx-4.v28.ch3.sourceforge.com: domain of nokia.com designates 192.100.122.230 as permitted sender) client-ip=192.100.122.230; envelope-from=roman.tereshonkov@nokia.com; helo=mgw-mx03.nokia.com; Received: from smtp.nokia.com ([192.100.122.230] helo=mgw-mx03.nokia.com) by sfi-mx-4.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1O2iEi-00012r-Sh for spi-devel-general@lists.sourceforge.net; Fri, 16 Apr 2010 09:53:22 +0000 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o3G9rBtH004254; Fri, 16 Apr 2010 12:53:12 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 16 Apr 2010 12:53:10 +0300 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 16 Apr 2010 12:53:09 +0300 Received: from localhost.localdomain (ramses.research.nokia.com [172.21.51.130]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o3G9r4bt014279; Fri, 16 Apr 2010 12:53:05 +0300 From: Roman Tereshonkov To: spi-devel-general@lists.sourceforge.net, glikely@secretlab.ca Date: Fri, 16 Apr 2010 12:52:59 +0300 Message-Id: <1271411579-30294-1-git-send-email-roman.tereshonkov@nokia.com> X-Mailer: git-send-email 1.6.2.rc1.3.g81d3f X-OriginalArrivalTime: 16 Apr 2010 09:53:10.0121 (UTC) FILETIME=[9F2B3D90:01CADD4A] X-Nokia-AV: Clean X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1O2iEi-00012r-Sh Cc: Roman Tereshonkov Subject: [spi-devel-general] [PATCH] spi: release device claimed by bus_find_device_by_name 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 16 Apr 2010 09:54:33 +0000 (UTC) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 9ffb0fd..ec429d1 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -257,6 +257,7 @@ int spi_add_device(struct spi_device *spi) { static DEFINE_MUTEX(spi_add_lock); struct device *dev = spi->master->dev.parent; + struct device *d; int status; /* Chipselects are numbered 0..max; validate. */ @@ -278,10 +279,11 @@ int spi_add_device(struct spi_device *spi) */ mutex_lock(&spi_add_lock); - if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)) - != NULL) { + d = bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)); + if (d != NULL) { dev_err(dev, "chipselect %d already in use\n", spi->chip_select); + put_device(d); status = -EBUSY; goto done; }