@@ -2512,6 +2512,7 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware
2512
2512
u8 * kmem = NULL ;
2513
2513
u32 modify_len ;
2514
2514
u32 item_len ;
2515
+ u8 cmd_err ;
2515
2516
u16 index ;
2516
2517
int rc ;
2517
2518
@@ -2595,6 +2596,8 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware
2595
2596
}
2596
2597
2597
2598
rc = hwrm_req_send_silent (bp , install );
2599
+ if (!rc )
2600
+ break ;
2598
2601
2599
2602
if (defrag_attempted ) {
2600
2603
/* We have tried to defragment already in the previous
@@ -2603,15 +2606,20 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware
2603
2606
break ;
2604
2607
}
2605
2608
2606
- if (rc && ((struct hwrm_err_output * )resp )-> cmd_err ==
2607
- NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR ) {
2609
+ cmd_err = ((struct hwrm_err_output * )resp )-> cmd_err ;
2610
+
2611
+ switch (cmd_err ) {
2612
+ case NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR :
2608
2613
install -> flags =
2609
2614
cpu_to_le16 (NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG );
2610
2615
2611
2616
rc = hwrm_req_send_silent (bp , install );
2617
+ if (!rc )
2618
+ break ;
2619
+
2620
+ cmd_err = ((struct hwrm_err_output * )resp )-> cmd_err ;
2612
2621
2613
- if (rc && ((struct hwrm_err_output * )resp )-> cmd_err ==
2614
- NVM_INSTALL_UPDATE_CMD_ERR_CODE_NO_SPACE ) {
2622
+ if (cmd_err == NVM_INSTALL_UPDATE_CMD_ERR_CODE_NO_SPACE ) {
2615
2623
/* FW has cleared NVM area, driver will create
2616
2624
* UPDATE directory and try the flash again
2617
2625
*/
@@ -2621,11 +2629,13 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmware
2621
2629
BNX_DIR_TYPE_UPDATE ,
2622
2630
BNX_DIR_ORDINAL_FIRST ,
2623
2631
0 , 0 , item_len , NULL , 0 );
2624
- } else if (rc ) {
2625
- netdev_err ( dev , "HWRM_NVM_INSTALL_UPDATE failure rc :%x\n" , rc ) ;
2632
+ if (! rc )
2633
+ break ;
2626
2634
}
2627
- } else if (rc ) {
2628
- netdev_err (dev , "HWRM_NVM_INSTALL_UPDATE failure rc :%x\n" , rc );
2635
+ fallthrough ;
2636
+ default :
2637
+ netdev_err (dev , "HWRM_NVM_INSTALL_UPDATE failure rc :%x cmd_err :%x\n" ,
2638
+ rc , cmd_err );
2629
2639
}
2630
2640
} while (defrag_attempted && !rc );
2631
2641
0 commit comments