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 <niklas.cassel@wdc.com>
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 <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Niklas Cassel 2021-05-04 07:11:53 +00:00 committed by Tomasz Zawadzki
parent 82e4bfd346
commit af72965519

View File

@ -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);