Add ForceClear also on dev->normal transitions. Fix wrong API description.
Review URL: http://codereview.chromium.org/2807006
diff --git a/vboot_firmware/include/rollback_index.h b/vboot_firmware/include/rollback_index.h
index 491814e..49e2c4f 100644
--- a/vboot_firmware/include/rollback_index.h
+++ b/vboot_firmware/include/rollback_index.h
@@ -47,11 +47,11 @@
* the developer switch is ON, 0 otherwise.
*
* If SetupTPM returns TPM_SUCCESS, the caller may proceed. If it returns
- * TPM_E_MUST_REBOOT, the caller must reboot in normal mode. For all other
- * return values, the caller must reboot in recovery mode.
+ * TPM_E_MUST_REBOOT, the caller must reboot in the current mode. For all
+ * other return values, the caller must reboot in recovery mode.
*
* This function has many side effects on the TPM state. In particular, when
- * called with mode = RECOVERY_MODE it locks the firmware versions before
+ * called with mode = RECOVERY_MODE, it locks the firmware versions before
* returning. In all other cases, the caller is responsible for locking the
* firmware versions once it decides it doesn't need to update them.
*/
diff --git a/vboot_firmware/lib/rollback_index.c b/vboot_firmware/lib/rollback_index.c
index b09ea64..1fed860 100644
--- a/vboot_firmware/lib/rollback_index.c
+++ b/vboot_firmware/lib/rollback_index.c
@@ -214,7 +214,7 @@
RETURN_ON_FAILURE(TlclRead(DEVELOPER_MODE_NV_INDEX,
(uint8_t*) &past_developer,
sizeof(past_developer)));
- must_clear = current_developer && !past_developer;
+ must_clear = current_developer != past_developer;
if (must_clear) {
RETURN_ON_FAILURE(TlclForceClear());
}