]> git.openfabrics.org - ~adrianc/mstflint.git/commitdiff
fixed issue where non-failsafe burn might corrupt the VPD
authorAdrian Chiris <adrianc@mellanox.com>
Tue, 23 Jun 2015 13:14:48 +0000 (16:14 +0300)
committerAdrian Chiris <adrianc@mellanox.com>
Tue, 23 Jun 2015 13:14:48 +0000 (16:14 +0300)
mlxfwops/lib/flint_io.cpp

index f2b2ba7b31cba06e4201e3e2a2b1ac7a4752e848..78f70530fb1d8884afe45f1ebdcd37e44ee3a4d7 100755 (executable)
@@ -554,8 +554,13 @@ bool Flash::write_sector_with_erase(u_int32_t addr, void *data, int cnt)
         return false;
     }
 
+    if (!erase_sector(sector)) {
+        return false;
+    }
+
     memcpy(&buff[word_in_sector], data, cnt);
-    return write(sector, &buff[0], sector_size);
+    // no need to erase twice noerase=true
+    return write(sector, &buff[0], sector_size, true);
 }
 
 bool Flash::write_with_erase(u_int32_t addr, void *data, int cnt)