net/ice/base: handle error gracefully in HW table calloc

In the ice_init_hw_tbls API, if the ice_calloc for es->written
fails, catch that error and bail out gracefully, instead of
continuing with a NULL pointer.

Signed-off-by: Surabhi Boob <surabhi.boob@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
This commit is contained in:
Qi Zhang 2020-08-26 11:14:07 +08:00 committed by Ferruh Yigit
parent 48958a77be
commit 8a15c69ce9

View File

@ -3908,11 +3908,19 @@ enum ice_status ice_init_hw_tbls(struct ice_hw *hw)
es->ref_count = (u16 *)
ice_calloc(hw, es->count, sizeof(*es->ref_count));
if (!es->ref_count)
goto err;
es->written = (u8 *)
ice_calloc(hw, es->count, sizeof(*es->written));
if (!es->written)
goto err;
es->mask_ena = (u32 *)
ice_calloc(hw, es->count, sizeof(*es->mask_ena));
if (!es->ref_count)
if (!es->mask_ena)
goto err;
}
return ICE_SUCCESS;