diff --git a/lib/util/io_channel.c b/lib/util/io_channel.c index 6898d67e3..97681c560 100644 --- a/lib/util/io_channel.c +++ b/lib/util/io_channel.c @@ -303,6 +303,10 @@ spdk_io_device_register(void *io_device, spdk_io_channel_create_cb create_cb, { struct io_device *dev, *tmp; + assert(io_device != NULL); + assert(create_cb != NULL); + assert(destroy_cb != NULL); + dev = calloc(1, sizeof(struct io_device)); if (dev == NULL) { SPDK_ERRLOG("could not allocate io_device\n"); diff --git a/test/unit/lib/util/io_channel.c/io_channel_ut.c b/test/unit/lib/util/io_channel.c/io_channel_ut.c index efda52d8f..0febd151d 100644 --- a/test/unit/lib/util/io_channel.c/io_channel_ut.c +++ b/test/unit/lib/util/io_channel.c/io_channel_ut.c @@ -353,12 +353,6 @@ destroy_cb_2(void *io_device, void *ctx_buf) g_destroy_cb_calls++; } -static int -create_cb_null(void *io_device, void *ctx_buf) -{ - return -1; -} - static void channel(void) { @@ -368,7 +362,6 @@ channel(void) spdk_allocate_thread(_send_msg, NULL, NULL, NULL, "thread0"); spdk_io_device_register(&device1, create_cb_1, destroy_cb_1, sizeof(ctx1)); spdk_io_device_register(&device2, create_cb_2, destroy_cb_2, sizeof(ctx2)); - spdk_io_device_register(&device3, create_cb_null, NULL, 0); g_create_cb_calls = 0; ch1 = spdk_get_io_channel(&device1);