update_kernel: check for verity even when kernel partition is given

We still need to check for verity (to decide to update kernel modules and firmware) even if the
kernel partition is specified on the command line.

BUG=chromium:315910
TEST=update_kernel.sh --partition=... to a system, make sure modules
  are still updated on a non-verity target.

Change-Id: I80539b5b1e0ab7b7cd052e4e7a4b2999a6b48772
Signed-off-by: Olof Johansson <olofj@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176690
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
diff --git a/update_kernel.sh b/update_kernel.sh
index 0c119f1..d71f283 100755
--- a/update_kernel.sh
+++ b/update_kernel.sh
@@ -45,7 +45,6 @@
 
 # Ask the target what the kernel partition is
 learn_partition_and_ro() {
-  [ -n "${FLAGS_partition}" ] && return
   ! remote_sh rootdev
   if [ "${REMOTE_OUT%%-*}" == "/dev/dm" ]; then
     remote_sh rootdev -s
@@ -55,6 +54,7 @@
     REMOTE_VERITY=${FLAGS_FALSE}
     info "System is not using verity: updating firmware and modules"
   fi
+  [ -n "${FLAGS_partition}" ] && return
   if [ "${REMOTE_OUT}" == "${FLAGS_device}3" ]; then
     FLAGS_partition="${FLAGS_device}2"
   else