4a713238b7
spdk_jsonrpc_send_error_response() is documented as a shorthand for spdk_jsonrpc_begin_result() + end result, but we used to call it already after doing spdk_jsonrpc_begin_result(), which makes the response completely invalid. Fix it by deferring the initial spdk_jsonrpc_begin_result() until after we did our error checking. While here, remove the NULL checks from that function. After recent jsonrpc changes it can never return NULL. Change-Id: Ibb69803d4e6ce6516817673eec6626dcfc4f1abf Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464174 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>