From: Wei Yongjun Date: Tue, 12 Nov 2013 23:10:24 +0000 (-0800) Subject: drivers/message/i2o/driver.c: add missing destroy_workqueue() on error in i2o_driver_... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=10992435b30eb470e6b91d2415abfb79680d00b6;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Acked-by: Kees Cook Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index b6b92d760510..1b18a0d1d05b 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c @@ -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; @@ -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;