amt: fix error return code in amt_init()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 2 Nov 2021 13:03:53 +0000 (21:03 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 3 Nov 2021 02:15:52 +0000 (19:15 -0700)
Return error code when alloc_workqueue()
fails in amt_init().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Taehee Yoo <ap420073@gmail.com>
Link: https://lore.kernel.org/r/20211102130353.1666999-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/amt.c

index 60a7053..d8c9ed9 100644 (file)
@@ -3259,8 +3259,10 @@ static int __init amt_init(void)
                goto unregister_notifier;
 
        amt_wq = alloc_workqueue("amt", WQ_UNBOUND, 1);
-       if (!amt_wq)
+       if (!amt_wq) {
+               err = -ENOMEM;
                goto rtnl_unregister;
+       }
 
        spin_lock_init(&source_gc_lock);
        spin_lock_bh(&source_gc_lock);