[PATCH v3 016/129] net/ice/base: alloc port_info only once

Anatoly Burakov anatoly.burakov at intel.com
Tue Jun 25 13:12:21 CEST 2024


From: Michal Swiatkowski <michal.swiatkowski at intel.com>

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 ebbe8cde1d..914096d1a6 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