summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-05-20 11:07:23 -0700
committerTony Lindgren <tony@atomide.com>2010-05-20 11:07:23 -0700
commitdf760137ad3cbfa15ceed42478f81bff01b6e799 (patch)
treebe939c9d11094858d74141a4c62cb23f477754d8 /drivers/spi/spi.c
parent754b8e653412106ff613f4750b197f807fcd8347 (diff)
parentde997718b64df2f766736f23f8557da450b83a25 (diff)
downloadop-kernel-dev-df760137ad3cbfa15ceed42478f81bff01b6e799.zip
op-kernel-dev-df760137ad3cbfa15ceed42478f81bff01b6e799.tar.gz
Merge branch 'omap-boards' into omap-for-linus
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 9ffb0fd..b3a1f92 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -41,7 +41,7 @@ static void spidev_release(struct device *dev)
spi->master->cleanup(spi);
spi_master_put(spi->master);
- kfree(dev);
+ kfree(spi);
}
static ssize_t
@@ -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;
}
OpenPOWER on IntegriCloud