git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
driver core: Fix unbalanced device reference in drivers_probe
[pandora-kernel.git]
/
drivers
/
base
/
bus.c
diff --git
a/drivers/base/bus.c
b/drivers/base/bus.c
index
000e7b2
..
b802cfc
100644
(file)
--- a/
drivers/base/bus.c
+++ b/
drivers/base/bus.c
@@
-240,13
+240,15
@@
static ssize_t store_drivers_probe(struct bus_type *bus,
const char *buf, size_t count)
{
struct device *dev;
const char *buf, size_t count)
{
struct device *dev;
+ int err = -EINVAL;
dev = bus_find_device_by_name(bus, NULL, buf);
if (!dev)
return -ENODEV;
dev = bus_find_device_by_name(bus, NULL, buf);
if (!dev)
return -ENODEV;
- if (bus_rescan_devices_helper(dev, NULL) != 0)
- return -EINVAL;
- return count;
+ if (bus_rescan_devices_helper(dev, NULL) == 0)
+ err = count;
+ put_device(dev);
+ return err;
}
#endif
}
#endif
@@
-289,7
+291,7
@@
int bus_for_each_dev(struct bus_type *bus, struct device *start,
struct device *dev;
int error = 0;
struct device *dev;
int error = 0;
- if (!bus)
+ if (!bus
|| !bus->p
)
return -EINVAL;
klist_iter_init_node(&bus->p->klist_devices, &i,
return -EINVAL;
klist_iter_init_node(&bus->p->klist_devices, &i,
@@
-323,7
+325,7
@@
struct device *bus_find_device(struct bus_type *bus,
struct klist_iter i;
struct device *dev;
struct klist_iter i;
struct device *dev;
- if (!bus)
+ if (!bus
|| !bus->p
)
return NULL;
klist_iter_init_node(&bus->p->klist_devices, &i,
return NULL;
klist_iter_init_node(&bus->p->klist_devices, &i,