diff options
author | Johannes Thumshirn <jthumshirn@suse.de> | 2016-05-03 03:46:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-05-03 18:07:35 -0400 |
commit | 18d28819809909c3f24bb72183a901c5e332a63d (patch) | |
tree | 4a900ad5de38046a5c65967f990d06989a7d7a57 /drivers/mcb | |
parent | bc46b45a421a64a0895dd41a34d3d2086e1ac7f6 (diff) |
mcb: Correctly initialize the bus's device
The mcb bus' device member wasn't correctly initialized and thus wasn't placed
correctly into the driver model.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Andreas Werner <andreas.werner@men.de>
Tested-by: Andreas Werner <andreas.werner@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mcb')
-rw-r--r-- | drivers/mcb/mcb-core.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c index a4be451074e5..1e336cc56751 100644 --- a/drivers/mcb/mcb-core.c +++ b/drivers/mcb/mcb-core.c | |||
@@ -187,6 +187,7 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier) | |||
187 | { | 187 | { |
188 | struct mcb_bus *bus; | 188 | struct mcb_bus *bus; |
189 | int bus_nr; | 189 | int bus_nr; |
190 | int rc; | ||
190 | 191 | ||
191 | bus = kzalloc(sizeof(struct mcb_bus), GFP_KERNEL); | 192 | bus = kzalloc(sizeof(struct mcb_bus), GFP_KERNEL); |
192 | if (!bus) | 193 | if (!bus) |
@@ -194,14 +195,26 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier) | |||
194 | 195 | ||
195 | bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL); | 196 | bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL); |
196 | if (bus_nr < 0) { | 197 | if (bus_nr < 0) { |
197 | kfree(bus); | 198 | rc = bus_nr; |
198 | return ERR_PTR(bus_nr); | 199 | goto err_free; |
199 | } | 200 | } |
200 | 201 | ||
201 | INIT_LIST_HEAD(&bus->children); | ||
202 | bus->bus_nr = bus_nr; | 202 | bus->bus_nr = bus_nr; |
203 | bus->carrier = carrier; | 203 | bus->carrier = carrier; |
204 | |||
205 | device_initialize(&bus->dev); | ||
206 | bus->dev.parent = carrier; | ||
207 | bus->dev.bus = &mcb_bus_type; | ||
208 | |||
209 | dev_set_name(&bus->dev, "mcb:%d", bus_nr); | ||
210 | rc = device_add(&bus->dev); | ||
211 | if (rc) | ||
212 | goto err_free; | ||
213 | |||
204 | return bus; | 214 | return bus; |
215 | err_free: | ||
216 | kfree(bus); | ||
217 | return ERR_PTR(rc); | ||
205 | } | 218 | } |
206 | EXPORT_SYMBOL_GPL(mcb_alloc_bus); | 219 | EXPORT_SYMBOL_GPL(mcb_alloc_bus); |
207 | 220 | ||