nvme: Fix controller disable from running when it should not

The need_update variable is being used to check before disabling
the controller, but this doesn't really correlate to running
nvme_enable_controller() or even being detected and having a
valid base address.

Add an enabled variable that is set after the device is detected
and successfully runs nvme_enable_controller() and check that
before calling nvme_disable_controller().

As part of this, move the message inside the if statement so it
does not get shown if the controller was not detected properly
and is therefore not running the shutdown code.

BUG=b:35581264
BRANCH=none
TEST=boot on system with nvme enabled but no device present
and ensure it does not print the message about shutting down
the controller.

Change-Id: Ic3771b1f363c1ba84f7d7d6d5f2db8b4e9b15718
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/508089
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Shelley Chen <shchen@chromium.org>
2 files changed