staging/rdma/hfi1: Fix missing firmware NULL dereference
authorDean Luick <dean.luick@intel.com>
Wed, 3 Feb 2016 22:31:40 +0000 (14:31 -0800)
committerDoug Ledford <dledford@redhat.com>
Fri, 11 Mar 2016 01:37:47 +0000 (20:37 -0500)
The gen3 bump code must mark a firmware download failure as fatal.
Otherwise a later load attempt will fail with a NULL dereference.

Also:
o Only do a firmware back-off for RTL.  There are no alternates for
  FPGA or simulation.
o Rearrange OS firmware request order to match what is actually
  loaded.  This results in more coherent informational messages
  in the case of missing firmware.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/staging/rdma/hfi1/firmware.c
drivers/staging/rdma/hfi1/pcie.c

index 28ae42faa0187885119fc82c54c328738ada5d0d..d954e1ab4bbead3c3a9af9d28f481cd9eb59f56f 100644 (file)
@@ -593,27 +593,27 @@ retry:
                fw_pcie_serdes_name = ALT_FW_PCIE_NAME;
        }
 
-       if (fw_8051_load) {
-               err = obtain_one_firmware(dd, fw_8051_name, &fw_8051);
+       if (fw_sbus_load) {
+               err = obtain_one_firmware(dd, fw_sbus_name, &fw_sbus);
                if (err)
                        goto done;
        }
 
-       if (fw_fabric_serdes_load) {
-               err = obtain_one_firmware(dd, fw_fabric_serdes_name,
-                       &fw_fabric);
+       if (fw_pcie_serdes_load) {
+               err = obtain_one_firmware(dd, fw_pcie_serdes_name, &fw_pcie);
                if (err)
                        goto done;
        }
 
-       if (fw_sbus_load) {
-               err = obtain_one_firmware(dd, fw_sbus_name, &fw_sbus);
+       if (fw_fabric_serdes_load) {
+               err = obtain_one_firmware(dd, fw_fabric_serdes_name,
+                                         &fw_fabric);
                if (err)
                        goto done;
        }
 
-       if (fw_pcie_serdes_load) {
-               err = obtain_one_firmware(dd, fw_pcie_serdes_name, &fw_pcie);
+       if (fw_8051_load) {
+               err = obtain_one_firmware(dd, fw_8051_name, &fw_8051);
                if (err)
                        goto done;
        }
@@ -621,8 +621,8 @@ retry:
 done:
        if (err) {
                /* oops, had problems obtaining a firmware */
-               if (fw_state == FW_EMPTY) {
-                       /* retry with alternate */
+               if (fw_state == FW_EMPTY && dd->icode == ICODE_RTL_SILICON) {
+                       /* retry with alternate (RTL only) */
                        fw_state = FW_TRY;
                        goto retry;
                }
index b2f553d860420c777b944e5ea9118475f597baa0..3cdc8047f16bc17a7f252f8769c424b540b794b9 100644 (file)
@@ -1032,8 +1032,11 @@ retry:
        /* step 4: download PCIe Gen3 SerDes firmware */
        dd_dev_info(dd, "%s: downloading firmware\n", __func__);
        ret = load_pcie_firmware(dd);
-       if (ret)
+       if (ret) {
+               /* do not proceed if the firmware cannot be downloaded */
+               return_error = 1;
                goto done;
+       }
 
        /* step 5: set up device parameter settings */
        dd_dev_info(dd, "%s: setting PCIe registers\n", __func__);