nfp: abm: fix error return code in nfp_abm_vnic_alloc()
authorWei Yongjun <weiyongjun1@huawei.com>
Fri, 8 May 2020 07:27:35 +0000 (07:27 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 9 May 2020 01:39:36 +0000 (18:39 -0700)
Fix to return negative error code -ENOMEM from the kzalloc() error
handling case instead of 0, as done elsewhere in this function.

Fixes: 174ab544e3bc ("nfp: abm: add cls_u32 offload for simple band classification")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/netronome/nfp/abm/main.c

index 354efffac0f9882f28c4fae9f87a9b9fc5094a0e..bdbf0726145e54cad25750abe956149ea2173ff7 100644 (file)
@@ -333,8 +333,10 @@ nfp_abm_vnic_alloc(struct nfp_app *app, struct nfp_net *nn, unsigned int id)
                goto err_free_alink;
 
        alink->prio_map = kzalloc(abm->prio_map_len, GFP_KERNEL);
-       if (!alink->prio_map)
+       if (!alink->prio_map) {
+               err = -ENOMEM;
                goto err_free_alink;
+       }
 
        /* This is a multi-host app, make sure MAC/PHY is up, but don't
         * make the MAC/PHY state follow the state of any of the ports.