From cc90d6fce858cea167102380e57a63af2f75ec8b Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Fri, 22 Jul 2016 14:13:40 -0700 Subject: [PATCH] greybus: bootrom: Skip setting timeout in failure path of size request The currently set value of next_request_type in the error path of gb_bootrom_firmware_size_request() is not correct, as it should have been NEXT_REQ_FIRMWARE_SIZE for the failure case (as we should be waiting for another similar request). But, if an error occurs in gb_bootrom_firmware_size_request(), then the ES3 bootrom will never be able to recover from it and send another request. And so there is no point waiting for another request and timing out. Skip doing that in error path. Reported-by: Johan Hovold Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/bootrom.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c index 309e0a7c865a..d16f13e0cb8d 100644 --- a/drivers/staging/greybus/bootrom.c +++ b/drivers/staging/greybus/bootrom.c @@ -223,9 +223,11 @@ unlock: mutex_unlock(&bootrom->mutex); queue_work: - /* Refresh timeout */ - gb_bootrom_set_timeout(bootrom, NEXT_REQ_GET_FIRMWARE, - NEXT_REQ_TIMEOUT_MS); + if (!ret) { + /* Refresh timeout */ + gb_bootrom_set_timeout(bootrom, NEXT_REQ_GET_FIRMWARE, + NEXT_REQ_TIMEOUT_MS); + } return ret; }