[PATCH 07/11] net/nfp: add the check about the firmware load

Chaoyong He chaoyong.he at corigine.com
Thu Nov 2 03:23:17 CET 2023


From: Peng Zhang <peng.zhang at corigine.com>

When firmware load failed, it doesn't have any notice.
So add the check about the firmware load and add an exit
point when the firmware load process fail.

Signed-off-by: Peng Zhang <peng.zhang at corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 3ebfd444b3..9378a2ebc3 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -654,7 +654,12 @@ nfp_fw_upload(struct rte_pci_device *dev,
 	PMD_DRV_LOG(INFO, "Firmware file found at %s with size: %zu",
 			fw_name, fsize);
 	PMD_DRV_LOG(INFO, "Uploading the firmware ...");
-	nfp_nsp_load_fw(nsp, fw_buf, fsize);
+	if (nfp_nsp_load_fw(nsp, fw_buf, fsize) < 0) {
+		free(fw_buf);
+		PMD_DRV_LOG(ERR, "Firmware load failed.");
+		return -EIO;
+	}
+
 	PMD_DRV_LOG(INFO, "Done");
 
 	free(fw_buf);
-- 
2.39.1



More information about the dev mailing list