ut/bdev_nvme: fix 'used uninitialised' warning

On some platforms, GCC identifies that opts.io_queue_requests is used
uninitialised in bdev_nvme_create_qpair due to the stub function
spdk_nvme_ctrlr_get_default_io_qpair_opts which would normally zero the
qpair opts. Whether the warning appears is likely to be determined by
how effectively the platform garbage collects unused code.

Replace the stub with a minimal implementation that zeros the qpair
opts to avoid the warning.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I2b8c2d657ae5401c3b35ca66938a966906cdc846
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6595
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Nick Connolly 2021-02-26 13:30:07 +00:00 committed by Tomasz Zawadzki
parent 2f579469b6
commit 292b8e0c3e

View File

@ -73,8 +73,13 @@ DEFINE_STUB(spdk_nvme_ctrlr_process_admin_completions, int32_t,
DEFINE_STUB(spdk_nvme_ctrlr_get_flags, uint64_t, (struct spdk_nvme_ctrlr *ctrlr), 0);
DEFINE_STUB_V(spdk_nvme_ctrlr_get_default_io_qpair_opts, (struct spdk_nvme_ctrlr *ctrlr,
struct spdk_nvme_io_qpair_opts *opts, size_t opts_size));
void
spdk_nvme_ctrlr_get_default_io_qpair_opts(struct spdk_nvme_ctrlr *ctrlr,
struct spdk_nvme_io_qpair_opts *opts, size_t opts_size)
{
/* Avoid warning that opts is used uninitialised */
memset(opts, 0, opts_size);
}
DEFINE_STUB(spdk_nvme_ctrlr_get_max_xfer_size, uint32_t,
(const struct spdk_nvme_ctrlr *ctrlr), 0);