From a3d1419b0515ae825c4bc57818caf3ba0f6bfd75 Mon Sep 17 00:00:00 2001 From: yidong0635 Date: Mon, 12 Oct 2020 11:21:48 -0400 Subject: [PATCH] example/ioat: Initialize global TAILQ HEAD variables at definition. Signed-off-by: yidong0635 Change-Id: I0364992ae1af0e102e5a05857bb4b3251765f7ff Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4597 Reviewed-by: Aleksey Marchuk Reviewed-by: Changpeng Liu Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- examples/ioat/perf/perf.c | 4 +--- examples/ioat/verify/verify.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/ioat/perf/perf.c b/examples/ioat/perf/perf.c index e2d94f2680..cd5a8cc3e6 100644 --- a/examples/ioat/perf/perf.c +++ b/examples/ioat/perf/perf.c @@ -52,7 +52,7 @@ struct ioat_device { TAILQ_ENTRY(ioat_device) tailq; }; -static TAILQ_HEAD(, ioat_device) g_devices; +static TAILQ_HEAD(, ioat_device) g_devices = TAILQ_HEAD_INITIALIZER(g_devices); static struct ioat_device *g_next_device; static struct user_config g_user_config; @@ -234,8 +234,6 @@ attach_cb(void *cb_ctx, struct spdk_pci_device *pci_dev, struct spdk_ioat_chan * static int ioat_init(void) { - TAILQ_INIT(&g_devices); - if (spdk_ioat_probe(NULL, probe_cb, attach_cb) != 0) { fprintf(stderr, "ioat_probe() failed\n"); return 1; diff --git a/examples/ioat/verify/verify.c b/examples/ioat/verify/verify.c index 441e32bfd7..cd4602a0fe 100644 --- a/examples/ioat/verify/verify.c +++ b/examples/ioat/verify/verify.c @@ -57,7 +57,7 @@ struct ioat_device { TAILQ_ENTRY(ioat_device) tailq; }; -static TAILQ_HEAD(, ioat_device) g_devices; +static TAILQ_HEAD(, ioat_device) g_devices = TAILQ_HEAD_INITIALIZER(g_devices); static struct ioat_device *g_next_device; static struct user_config g_user_config; @@ -227,8 +227,6 @@ attach_cb(void *cb_ctx, struct spdk_pci_device *pci_dev, struct spdk_ioat_chan * static int ioat_init(void) { - TAILQ_INIT(&g_devices); - if (spdk_ioat_probe(NULL, probe_cb, attach_cb) != 0) { fprintf(stderr, "ioat_probe() failed\n"); return 1;