Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/message/i2o/driver.c: add missing destroy_workqueue() on error 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 <yongjun_wei@trendmicro.com.cn>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Wei Yongjun and committed by
Linus Torvalds
10992435 ab767865

+10 -6
+10 -6
drivers/message/i2o/driver.c
··· 105 105 osm_err("too many drivers registered, increase " 106 106 "max_drivers\n"); 107 107 spin_unlock_irqrestore(&i2o_drivers_lock, flags); 108 - return -EFAULT; 108 + rc = -EFAULT; 109 + goto out; 109 110 } 110 111 111 112 drv->context = i; ··· 125 124 } 126 125 127 126 rc = driver_register(&drv->driver); 128 - if (rc) { 129 - if (drv->event) { 130 - destroy_workqueue(drv->event_queue); 131 - drv->event_queue = NULL; 132 - } 127 + if (rc) 128 + goto out; 129 + 130 + return 0; 131 + out: 132 + if (drv->event_queue) { 133 + destroy_workqueue(drv->event_queue); 134 + drv->event_queue = NULL; 133 135 } 134 136 135 137 return rc;