From af7296551980f28f4f7395c8869df2cdcd23bdaf Mon Sep 17 00:00:00 2001 From: Niklas Cassel Date: Tue, 4 May 2021 07:11:53 +0000 Subject: [PATCH] bdev/fio_plugin: fix scan-build error spdk_fio_init_thread() assigns td->io_ops_data. spdk_fio_init_thread() can return an error, but currently lacks error handling code. Add error handling code, and add an assertion that fio_thread (td->io_ops_data) is assigned when spdk_fio_init_thread() didn't return an error. Signed-off-by: Niklas Cassel Change-Id: I8de7d59db0373599c90aa57fffa476c6707b6104 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7732 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- examples/bdev/fio_plugin/fio_plugin.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c index 8d82e0363..8b12d3b26 100644 --- a/examples/bdev/fio_plugin/fio_plugin.c +++ b/examples/bdev/fio_plugin/fio_plugin.c @@ -539,10 +539,15 @@ static int spdk_fio_init(struct thread_data *td) { struct spdk_fio_thread *fio_thread; + int rc; - spdk_fio_init_thread(td); + rc = spdk_fio_init_thread(td); + if (rc) { + return rc; + } fio_thread = td->io_ops_data; + assert(fio_thread); fio_thread->failed = false; spdk_thread_send_msg(fio_thread->thread, spdk_fio_bdev_open, td);