diff options
author | faqiang.zhu <faqiang.zhu@nxp.com> | 2018-11-28 21:35:37 +0800 |
---|---|---|
committer | faqiang.zhu <faqiang.zhu@nxp.com> | 2018-11-29 09:59:04 +0800 |
commit | f322e8a2c62e765f434d14bd77ed97594b0acaa1 (patch) | |
tree | 2c62663ce3ef2f1dcf3ea53d21a5ce18e52bc143 | |
parent | 654088cc211e021387b04a8c33420739da40ebbe (diff) |
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>
-rw-r--r-- | drivers/usb/gadget/f_fastboot.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index 0962346005c..e7a7b39f762 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -3605,12 +3605,12 @@ static FbLockState do_fastboot_unlock(bool force) { int status; + if (fastboot_get_lock_stat() == FASTBOOT_UNLOCK) { + printf("The device is already unlocked\n"); + return FASTBOOT_UNLOCK; + } if ((fastboot_lock_enable() == FASTBOOT_UL_ENABLE) || force) { printf("It is able to unlock device. %d\n",fastboot_lock_enable()); - if (fastboot_get_lock_stat() == FASTBOOT_UNLOCK) { - printf("The device is already unlocked\n"); - return FASTBOOT_UNLOCK; - } status = fastboot_set_lock_stat(FASTBOOT_UNLOCK); if (status < 0) return FASTBOOT_LOCK_ERROR; |