From: Peng Zhang <peng.zh...@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.zh...@corigine.com> Reviewed-by: Chaoyong He <chaoyong...@corigine.com> Reviewed-by: Long Wu <long...@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