summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorji.luo <ji.luo@nxp.com>2017-11-15 13:20:44 +0800
committerji.luo <ji.luo@nxp.com>2017-11-16 14:43:40 +0800
commitd65ff484aad12e532521de61fa6be888c258d2f0 (patch)
tree644cd63e6c889dcc8937e5342c3d562a0d0cdeb8
parentf340d0678d8f3576e769b87984ddddf71243a29b (diff)
MA-10621 Fix no error returned when lock/unlock fail
Make do_fastboot_unlock() and fastboot_lock() return FbLockState type and correct the compare logic in cb_flashing(). Change-Id: I6df6f39a8aa3197299daa0d64408ac72a54fb5e9 Signed-off-by: ji.luo <ji.luo@nxp.com>
-rw-r--r--drivers/usb/gadget/f_fastboot.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 7b8e938591..bf9006efde 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -2603,7 +2603,7 @@ U_BOOT_CMD(
"lock_status",
"lock_status");
-static int do_fastboot_unlock(bool force)
+static FbLockState do_fastboot_unlock(bool force)
{
int status;
if (force)
@@ -2612,11 +2612,11 @@ static int do_fastboot_unlock(bool 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 1;
+ return FASTBOOT_UNLOCK;
}
status = fastboot_set_lock_stat(FASTBOOT_UNLOCK);
if (status < 0)
- return status;
+ return FASTBOOT_LOCK_ERROR;
printf("Start /data wipe process....\n");
fastboot_wipe_data_partition();
@@ -2629,28 +2629,28 @@ static int do_fastboot_unlock(bool force)
#endif
} else {
printf("It is not able to unlock device.");
- return -1;
+ return FASTBOOT_LOCK_ERROR;
}
- return status;
+ return FASTBOOT_UNLOCK;
}
-static int do_fastboot_lock(void)
+static FbLockState do_fastboot_lock(void)
{
int status;
if (fastboot_get_lock_stat() == FASTBOOT_LOCK) {
printf("The device is already locked\n");
- return 1;
+ return FASTBOOT_LOCK;
}
status = fastboot_set_lock_stat(FASTBOOT_LOCK);
if (status < 0)
- return status;
+ return FASTBOOT_LOCK_ERROR;
printf("Start /data wipe process....\n");
fastboot_wipe_data_partition();
printf("Wipe /data completed.\n");
- return status;
+ return FASTBOOT_LOCK;
}
static void cb_flashing(struct usb_ep *ep, struct usb_request *req)
@@ -2667,14 +2667,14 @@ static void cb_flashing(struct usb_ep *ep, struct usb_request *req)
} else if (!strncmp(cmd + len - 6, "unlock", 6)) {
printf("flashing unlock.\n");
status = do_fastboot_unlock(false);
- if (status >= 0)
+ if (status != FASTBOOT_LOCK_ERROR)
strcpy(response, "OKAY");
else
strcpy(response, "FAIL unlock device failed.");
} else if (!strncmp(cmd + len - 4, "lock", 4)) {
printf("flashing lock.\n");
status = do_fastboot_lock();
- if (status >= 0)
+ if (status != FASTBOOT_LOCK_ERROR)
strcpy(response, "OKAY");
else
strcpy(response, "FAIL lock device failed.");