From: Jie Liu <[email protected]>

sxe2_drv_udp_tunnel_get() fills tunnel_config fields even when the
firmware command fails, so a failed get overwrites the config with
the (zero-initialized) response data instead of leaving it intact.

Return early with the error code when sxe2_drv_cmd_exec() fails,
matching the V3 implementation.

Cc: [email protected]
Cc: [email protected]
Signed-off-by: Jie Liu <[email protected]>
---
 drivers/net/sxe2/sxe2_cmd_chnl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sxe2/sxe2_cmd_chnl.c b/drivers/net/sxe2/sxe2_cmd_chnl.c
index 5102890107..8c45554637 100644
--- a/drivers/net/sxe2/sxe2_cmd_chnl.c
+++ b/drivers/net/sxe2/sxe2_cmd_chnl.c
@@ -1669,15 +1669,17 @@ int32_t sxe2_drv_udp_tunnel_get(struct sxe2_adapter 
*adapter,
                                 &req, sizeof(req),
                                 &resp, sizeof(resp));
        ret = sxe2_drv_cmd_exec(cdev, &cmd);
-       if (ret)
+       if (ret) {
                PMD_LOG_ERR(DRV, "Failed to get udp proto %d port, ret=%d", 
req.type, ret);
+               goto l_end;
+       }
 
        tunnel_config->fw_port   = resp.port;
        tunnel_config->fw_status = resp.enable;
        tunnel_config->fw_dst_en = resp.dst;
        tunnel_config->fw_src_en = resp.src;
        tunnel_config->fw_used   = resp.fw_used;
-
+l_end:
        return ret;
 }
 
-- 
2.52.0

Reply via email to