iavf: fix error return code in iavf_init_get_resources()
authorWei Yongjun <weiyongjun1@huawei.com>
Thu, 18 Jun 2020 14:19:53 +0000 (14:19 +0000)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 1 Jul 2020 21:18:54 +0000 (14:18 -0700)
Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: b66c7bc1cd4d ("iavf: Refactor init state machine")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/iavf/iavf_main.c

index 78bd9e3df3ac216b9e72238f36834eff3c4ad32c..b90ad1abbabbfbe1bc6d3789f7650b70505c6512 100644 (file)
@@ -1852,8 +1852,10 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter)
 
        adapter->rss_key = kzalloc(adapter->rss_key_size, GFP_KERNEL);
        adapter->rss_lut = kzalloc(adapter->rss_lut_size, GFP_KERNEL);
-       if (!adapter->rss_key || !adapter->rss_lut)
+       if (!adapter->rss_key || !adapter->rss_lut) {
+               err = -ENOMEM;
                goto err_mem;
+       }
        if (RSS_AQ(adapter))
                adapter->aq_required |= IAVF_FLAG_AQ_CONFIGURE_RSS;
        else