diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/spi/spi.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b76f2468a84a..b3a1f9259b62 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/cache.h> | 24 | #include <linux/cache.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/slab.h> | ||
26 | #include <linux/mod_devicetable.h> | 27 | #include <linux/mod_devicetable.h> |
27 | #include <linux/spi/spi.h> | 28 | #include <linux/spi/spi.h> |
28 | 29 | ||
@@ -40,7 +41,7 @@ static void spidev_release(struct device *dev) | |||
40 | spi->master->cleanup(spi); | 41 | spi->master->cleanup(spi); |
41 | 42 | ||
42 | spi_master_put(spi->master); | 43 | spi_master_put(spi->master); |
43 | kfree(dev); | 44 | kfree(spi); |
44 | } | 45 | } |
45 | 46 | ||
46 | static ssize_t | 47 | static ssize_t |
@@ -256,6 +257,7 @@ int spi_add_device(struct spi_device *spi) | |||
256 | { | 257 | { |
257 | static DEFINE_MUTEX(spi_add_lock); | 258 | static DEFINE_MUTEX(spi_add_lock); |
258 | struct device *dev = spi->master->dev.parent; | 259 | struct device *dev = spi->master->dev.parent; |
260 | struct device *d; | ||
259 | int status; | 261 | int status; |
260 | 262 | ||
261 | /* Chipselects are numbered 0..max; validate. */ | 263 | /* Chipselects are numbered 0..max; validate. */ |
@@ -277,10 +279,11 @@ int spi_add_device(struct spi_device *spi) | |||
277 | */ | 279 | */ |
278 | mutex_lock(&spi_add_lock); | 280 | mutex_lock(&spi_add_lock); |
279 | 281 | ||
280 | if (bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)) | 282 | d = bus_find_device_by_name(&spi_bus_type, NULL, dev_name(&spi->dev)); |
281 | != NULL) { | 283 | if (d != NULL) { |
282 | dev_err(dev, "chipselect %d already in use\n", | 284 | dev_err(dev, "chipselect %d already in use\n", |
283 | spi->chip_select); | 285 | spi->chip_select); |
286 | put_device(d); | ||
284 | status = -EBUSY; | 287 | status = -EBUSY; |
285 | goto done; | 288 | goto done; |
286 | } | 289 | } |