Skip to content

Commit

Permalink
drivers/message/i2o/driver.c: add missing destroy_workqueue() on erro…
Browse files Browse the repository at this point in the history
…r in i2o_driver_register()

Add the missing destroy_workqueue() before return from
i2o_driver_register() in the error handling case.

Signed-off-by: Wei Yongjun <[email protected]>
Acked-by: Kees Cook <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Wei Yongjun authored and torvalds committed Nov 13, 2013
1 parent ab76786 commit 1099243
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions drivers/message/i2o/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ int i2o_driver_register(struct i2o_driver *drv)
osm_err("too many drivers registered, increase "
"max_drivers\n");
spin_unlock_irqrestore(&i2o_drivers_lock, flags);
return -EFAULT;
rc = -EFAULT;
goto out;
}

drv->context = i;
Expand All @@ -124,11 +125,14 @@ int i2o_driver_register(struct i2o_driver *drv)
}

rc = driver_register(&drv->driver);
if (rc) {
if (drv->event) {
destroy_workqueue(drv->event_queue);
drv->event_queue = NULL;
}
if (rc)
goto out;

return 0;
out:
if (drv->event_queue) {
destroy_workqueue(drv->event_queue);
drv->event_queue = NULL;
}

return rc;
Expand Down

0 comments on commit 1099243

Please sign in to comment.