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: Seth 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: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2020-04-22 13:22:02 -07:00 committed by Tomasz Zawadzki
parent e99aa89108
commit bed1458044

View File

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