Commit bed14580 authored by Seth Howell's avatar Seth Howell Committed by Tomasz Zawadzki
Browse files

lib/nvme: fix references to values in response_get_string



We were referencing the response before checking if it was NULL.

fix kw warning #10387

Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Change-Id: I333d13a8f16874a35d7de8e6659125f3bee83c13
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1980


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent e99aa891
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -561,8 +561,7 @@ opal_response_get_string(const struct spdk_opal_resp_parsed *resp, int n,
			 const char **store)
{
	uint8_t header_len;
	struct spdk_opal_resp_token token = resp->resp_tokens[n];

	struct spdk_opal_resp_token token;
	*store = NULL;
	if (!resp) {
		SPDK_ERRLOG("Response is NULL\n");
@@ -575,6 +574,7 @@ opal_response_get_string(const struct spdk_opal_resp_parsed *resp, int n,
		return 0;
	}

	token = resp->resp_tokens[n];
	if (token.type != OPAL_DTA_TOKENID_BYTESTRING) {
		SPDK_ERRLOG("Token is not a byte string!\n");
		return 0;