From 6d5c2d2bd130f1f17a93ede91d73c160c24a3f26 Mon Sep 17 00:00:00 2001 From: GangCao Date: Tue, 26 Dec 2017 15:46:30 -0500 Subject: [PATCH] io_channel: add the check for the existence of poller_fn There existing some cases like in our UT code, the start_poller_fn and stop_poller_fn is not configured. Add a check here and properly handle these cases. Change-Id: Iaac83d78547432584f6de0c54e9d2e06b9b35741 Signed-off-by: GangCao Reviewed-on: https://review.gerrithub.io/392996 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris --- lib/util/io_channel.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/util/io_channel.c b/lib/util/io_channel.c index 89c5ee7fb..d1ce7c543 100644 --- a/lib/util/io_channel.c +++ b/lib/util/io_channel.c @@ -208,6 +208,11 @@ spdk_poller_register(spdk_poller_fn fn, abort(); } + if (!thread->start_poller_fn || !thread->stop_poller_fn) { + SPDK_ERRLOG("No related functions to start requested poller\n"); + abort(); + } + poller = thread->start_poller_fn(thread->thread_ctx, fn, arg, period_microseconds); if (!poller) { SPDK_ERRLOG("Unable to start requested poller\n");