staging: wilc1000: fix return value check in wlan_initialize_threads()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Fri, 17 Jun 2016 17:34:17 +0000 (17:34 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2016 21:41:18 +0000 (14:41 -0700)
In case of error, the function kthread_run() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c

index 2ce9df5c6885c8622d9456af752c082a4195d2fd..3a66255f14fc77a7376eedee063452c0b45c06be 100644 (file)
@@ -715,10 +715,10 @@ static int wlan_initialize_threads(struct net_device *dev)
 
        wilc->txq_thread = kthread_run(linux_wlan_txq_task, (void *)dev,
                                     "K_TXQ_TASK");
-       if (!wilc->txq_thread) {
+       if (IS_ERR(wilc->txq_thread)) {
                netdev_err(dev, "couldn't create TXQ thread\n");
                wilc->close = 0;
-               return -ENOBUFS;
+               return PTR_ERR(wilc->txq_thread);
        }
        wait_for_completion(&wilc->txq_thread_started);