Commit f322e8a2c62e765f434d14bd77ed97594b0acaa1

Authored by faqiang.zhu
1 parent 654088cc21

MA-13603 change unlock logic to firstly judge unlocked or not

to handle situations that it is not allowed to unlock but the board is
already unlocked, unlock logic is modified in this patch

Change-Id: I90b22c2dfbc1c64ed9514032986e98b27526c7b9
Signed-off-by: faqiang.zhu <faqiang.zhu@nxp.com>

Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff

drivers/usb/gadget/f_fastboot.c
... ... @@ -3605,12 +3605,12 @@
3605 3605 {
3606 3606 int status;
3607 3607  
  3608 + if (fastboot_get_lock_stat() == FASTBOOT_UNLOCK) {
  3609 + printf("The device is already unlocked\n");
  3610 + return FASTBOOT_UNLOCK;
  3611 + }
3608 3612 if ((fastboot_lock_enable() == FASTBOOT_UL_ENABLE) || force) {
3609 3613 printf("It is able to unlock device. %d\n",fastboot_lock_enable());
3610   - if (fastboot_get_lock_stat() == FASTBOOT_UNLOCK) {
3611   - printf("The device is already unlocked\n");
3612   - return FASTBOOT_UNLOCK;
3613   - }
3614 3614 status = fastboot_set_lock_stat(FASTBOOT_UNLOCK);
3615 3615 if (status < 0)
3616 3616 return FASTBOOT_LOCK_ERROR;