From 66349fbf7b1f5f4a2c9b6f64c83d84c22e9ce381 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 23 May 2017 13:53:45 -0700 Subject: [PATCH] hello_world: fail if no NVMe devices found Signed-off-by: Jim Harris Change-Id: I90feac0377b4870c1552df3eb470e834ceae4f65 Reviewed-on: https://review.gerrithub.io/362265 Reviewed-by: Daniel Verkamp Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker --- examples/nvme/hello_world/hello_world.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/nvme/hello_world/hello_world.c b/examples/nvme/hello_world/hello_world.c index 9baf52840..7fcdad91b 100644 --- a/examples/nvme/hello_world/hello_world.c +++ b/examples/nvme/hello_world/hello_world.c @@ -334,6 +334,12 @@ int main(int argc, char **argv) return 1; } + if (g_controllers == NULL) { + fprintf(stderr, "no NVMe controllers found\n"); + cleanup(); + return 1; + } + printf("Initialization complete.\n"); hello_world(); cleanup();