From: Jens Axboe Date: Tue, 28 Feb 2023 15:28:51 +0000 (-0700) Subject: fdp: cleanup init X-Git-Tag: fio-3.34~10 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=5a85d6d89ee4e8bcdc1243a5e32d87cf713ebce2 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 --- 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; }