From 5a85d6d89ee4e8bcdc1243a5e32d87cf713ebce2 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 28 Feb 2023 08:28:51 -0700 Subject: [PATCH] fdp: cleanup init I don't believe we can have a NULL ->io_ops here, but let's just add an error check and make the static checkers happy as they don't like the non-NULL check and then a later deref in the other branch. Add missing braces while at it. Signed-off-by: Jens Axboe --- fdp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fdp.c b/fdp.c index 0f1aae5e..c50af1e2 100644 --- a/fdp.c +++ b/fdp.c @@ -20,16 +20,22 @@ static int fdp_ruh_info(struct thread_data *td, struct fio_file *f, { int ret = -EINVAL; - if (td->io_ops && td->io_ops->fdp_fetch_ruhs) { + if (!td->io_ops) { + log_err("fio: no ops set in fdp init?!\n"); + return ret; + } + + if (td->io_ops->fdp_fetch_ruhs) { ret = td->io_ops->fdp_fetch_ruhs(td, f, ruhs); if (ret < 0) { td_verror(td, errno, "fdp fetch ruhs failed"); log_err("%s: fdp fetch ruhs failed (%d)\n", f->file_name, errno); } - } else + } else { log_err("%s: engine (%s) lacks fetch ruhs\n", f->file_name, td->io_ops->name); + } return ret; } -- 2.25.1