]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/message/i2o/driver.c: add missing destroy_workqueue() on error in i2o_driver_...
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Tue, 5 Nov 2013 05:57:05 +0000 (16:57 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 5 Nov 2013 05:57:05 +0000 (16:57 +1100)
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>
drivers/message/i2o/driver.c

index 813eaa33fa1431af96a2c2f3ac40b1000dd9ed7b..c3d8462bb54c228a8c541834600c39c50384e556 100644 (file)
@@ -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;