Author: np
Date: Mon Apr 22 17:00:30 2019
New Revision: 346567
URL: https://svnweb.freebsd.org/changeset/base/346567

Log:
  cxgbe(4): Make sure bundled_fw is always initialized before use.
  
  This fixes a bug that prevented the driver from auto-flashing the
  firmware when it didn't see one on the card.  This feature was
  introduced in r321390 and this bug was introduced in r343269.
  
  Reported by:  gallatin@
  MFC after:    1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c        Mon Apr 22 16:29:34 2019        
(r346566)
+++ head/sys/dev/cxgbe/t4_main.c        Mon Apr 22 17:00:30 2019        
(r346567)
@@ -3529,19 +3529,6 @@ install_kld_firmware(struct adapter *sc, struct fw_h *
        load_attempted = false;
        fw_install = t4_fw_install < 0 ? -t4_fw_install : t4_fw_install;
 
-       if (reason != NULL)
-               goto install;
-
-       if ((sc->flags & FW_OK) == 0) {
-
-               if (c == 0xffffffff) {
-                       reason = "missing";
-                       goto install;
-               }
-
-               return (0);
-       }
-
        memcpy(&bundled_fw, drv_fw, sizeof(bundled_fw));
        if (t4_fw_install < 0) {
                rc = load_fw_module(sc, &cfg, &fw);
@@ -3557,6 +3544,20 @@ install_kld_firmware(struct adapter *sc, struct fw_h *
                load_attempted = true;
        }
        d = be32toh(bundled_fw.fw_ver);
+
+       if (reason != NULL)
+               goto install;
+
+       if ((sc->flags & FW_OK) == 0) {
+
+               if (c == 0xffffffff) {
+                       reason = "missing";
+                       goto install;
+               }
+
+               rc = 0;
+               goto done;
+       }
 
        if (!fw_compatible(card_fw, &bundled_fw)) {
                reason = "incompatible or unusable";
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to