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 <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/392996
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
GangCao 2017-12-26 15:46:30 -05:00 committed by Jim Harris
parent 583a24a489
commit 6d5c2d2bd1

View File

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