diff options
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/i2o/driver.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index d3235f213c89..e0d474b17433 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c | |||
@@ -123,8 +123,12 @@ int i2o_driver_register(struct i2o_driver *drv) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | rc = driver_register(&drv->driver); | 125 | rc = driver_register(&drv->driver); |
126 | if (rc) | 126 | if (rc) { |
127 | destroy_workqueue(drv->event_queue); | 127 | if (drv->event) { |
128 | destroy_workqueue(drv->event_queue); | ||
129 | drv->event_queue = NULL; | ||
130 | } | ||
131 | } | ||
128 | 132 | ||
129 | return rc; | 133 | return rc; |
130 | }; | 134 | }; |
@@ -256,7 +260,7 @@ void i2o_driver_notify_controller_add_all(struct i2o_controller *c) | |||
256 | int i; | 260 | int i; |
257 | struct i2o_driver *drv; | 261 | struct i2o_driver *drv; |
258 | 262 | ||
259 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 263 | for (i = 0; i < i2o_max_drivers; i++) { |
260 | drv = i2o_drivers[i]; | 264 | drv = i2o_drivers[i]; |
261 | 265 | ||
262 | if (drv) | 266 | if (drv) |
@@ -276,7 +280,7 @@ void i2o_driver_notify_controller_remove_all(struct i2o_controller *c) | |||
276 | int i; | 280 | int i; |
277 | struct i2o_driver *drv; | 281 | struct i2o_driver *drv; |
278 | 282 | ||
279 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 283 | for (i = 0; i < i2o_max_drivers; i++) { |
280 | drv = i2o_drivers[i]; | 284 | drv = i2o_drivers[i]; |
281 | 285 | ||
282 | if (drv) | 286 | if (drv) |
@@ -295,7 +299,7 @@ void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev) | |||
295 | int i; | 299 | int i; |
296 | struct i2o_driver *drv; | 300 | struct i2o_driver *drv; |
297 | 301 | ||
298 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 302 | for (i = 0; i < i2o_max_drivers; i++) { |
299 | drv = i2o_drivers[i]; | 303 | drv = i2o_drivers[i]; |
300 | 304 | ||
301 | if (drv) | 305 | if (drv) |
@@ -314,7 +318,7 @@ void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev) | |||
314 | int i; | 318 | int i; |
315 | struct i2o_driver *drv; | 319 | struct i2o_driver *drv; |
316 | 320 | ||
317 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 321 | for (i = 0; i < i2o_max_drivers; i++) { |
318 | drv = i2o_drivers[i]; | 322 | drv = i2o_drivers[i]; |
319 | 323 | ||
320 | if (drv) | 324 | if (drv) |
@@ -335,17 +339,15 @@ int __init i2o_driver_init(void) | |||
335 | 339 | ||
336 | spin_lock_init(&i2o_drivers_lock); | 340 | spin_lock_init(&i2o_drivers_lock); |
337 | 341 | ||
338 | if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) || | 342 | if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64)) { |
339 | ((i2o_max_drivers ^ (i2o_max_drivers - 1)) != | 343 | osm_warn("max_drivers set to %d, but must be >=2 and <= 64\n", |
340 | (2 * i2o_max_drivers - 1))) { | 344 | i2o_max_drivers); |
341 | osm_warn("max_drivers set to %d, but must be >=2 and <= 64 and " | ||
342 | "a power of 2\n", i2o_max_drivers); | ||
343 | i2o_max_drivers = I2O_MAX_DRIVERS; | 345 | i2o_max_drivers = I2O_MAX_DRIVERS; |
344 | } | 346 | } |
345 | osm_info("max drivers = %d\n", i2o_max_drivers); | 347 | osm_info("max drivers = %d\n", i2o_max_drivers); |
346 | 348 | ||
347 | i2o_drivers = | 349 | i2o_drivers = |
348 | kzalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); | 350 | kcalloc(i2o_max_drivers, sizeof(*i2o_drivers), GFP_KERNEL); |
349 | if (!i2o_drivers) | 351 | if (!i2o_drivers) |
350 | return -ENOMEM; | 352 | return -ENOMEM; |
351 | 353 | ||