Commit bcc46cb8 authored by Surabhi Boob's avatar Surabhi Boob Committed by Tony Nguyen
Browse files

ice: Graceful error handling in HW table calloc failure



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

Fixes: 32d63fa1 ("ice: Initialize DDP package structures")
Signed-off-by: default avatarSurabhi Boob <surabhi.boob@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 0a37abfa
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3151,10 +3151,12 @@ enum ice_status ice_init_hw_tbls(struct ice_hw *hw)
		es->ref_count = devm_kcalloc(ice_hw_to_dev(hw), es->count,
					     sizeof(*es->ref_count),
					     GFP_KERNEL);
		if (!es->ref_count)
			goto err;

		es->written = devm_kcalloc(ice_hw_to_dev(hw), es->count,
					   sizeof(*es->written), GFP_KERNEL);
		if (!es->ref_count)
		if (!es->written)
			goto err;
	}
	return 0;