[PATCH v2 017/148] net/ice/base: alloc port_info only once

Anatoly Burakov anatoly.burakov at intel.com
Wed Jun 12 17:00:11 CEST 2024


When devlink reload is called port_info should stay. Check if it wasn't already
allocated before doing allocation.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski at intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 drivers/net/ice/base/ice_common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index 9b08a10022..f88ced7a5d 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -1006,7 +1006,8 @@ int ice_init_hw(struct ice_hw *hw)
 	if (status)
 		goto err_unroll_cqinit;
 
-	hw->port_info = (struct ice_port_info *)
+	if (!hw->port_info)
+		hw->port_info = (struct ice_port_info *)
 			ice_malloc(hw, sizeof(*hw->port_info));
 	if (!hw->port_info) {
 		status = ICE_ERR_NO_MEMORY;
-- 
2.43.0



More information about the dev mailing list