bdev: add null check to spdk_bdev_unregister:

Newer versions of scan-build complain about cb_fn potentially being null
in spdk_bdev_unregister.

Change-Id: Ib5607234557f2104ee30398a620fa595389a33e9
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/417064
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Seth Howell 2018-06-27 12:40:02 -07:00 committed by Daniel Verkamp
parent 4c4e2b4d80
commit dd7b90fac9

View File

@ -2899,7 +2899,9 @@ spdk_bdev_unregister(struct spdk_bdev *bdev, spdk_bdev_unregister_cb cb_fn, void
thread = spdk_get_thread();
if (!thread) {
/* The user called this from a non-SPDK thread. */
cb_fn(cb_arg, -ENOTSUP);
if (cb_fn != NULL) {
cb_fn(cb_arg, -ENOTSUP);
}
return;
}