module/nvme: Fix warning about scanbuild.

Analyzer treats these as warning, they are unused.

Issue:
bdev_nvme_rpc.c:706:7: warning: Although the value
stored to 'rc' is used in the enclosing expression,
the value is never actually read from 'rc'
        if ((rc = spdk_nvme_ctrlr_reset(firm_ctx->ctrlr)) != 0) {
             ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bdev_nvme_rpc.c:851:8: warning: Although the value
stored to 'rc' is used in the enclosing expression,
the value is never actually read from 'rc'
         if ((rc = spdk_bdev_open(bdev2, true, NULL, NULL, &desc)) != 0) {
              ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
nvme_rpc.c:375:10: warning: Although the value stored
to 'rc' is used in the enclosing expression, the value is
never actually read from 'rc'
        return rc = val->type == SPDK_JSON_VAL_STRING ? -ENOMEM : -EINVAL;
                ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I1d58db97b00ac2d102c1a46d7852c2ce3f559fda
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4824
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
yidong0635 2020-10-22 12:39:36 -04:00 committed by Tomasz Zawadzki
parent fd661859ed
commit eb9577f8d5
2 changed files with 3 additions and 4 deletions

View File

@ -690,7 +690,6 @@ apply_firmware_cleanup(void *cb_arg)
static void
apply_firmware_complete_reset(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
{
int rc;
struct spdk_json_write_ctx *w;
struct firmware_update_info *firm_ctx = cb_arg;
@ -703,7 +702,7 @@ apply_firmware_complete_reset(struct spdk_bdev_io *bdev_io, bool success, void *
return;
}
if ((rc = spdk_nvme_ctrlr_reset(firm_ctx->ctrlr)) != 0) {
if (spdk_nvme_ctrlr_reset(firm_ctx->ctrlr) != 0) {
spdk_jsonrpc_send_error_response(firm_ctx->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"Controller reset failed.");
apply_firmware_cleanup(firm_ctx);
@ -848,7 +847,7 @@ rpc_bdev_nvme_apply_firmware(struct spdk_jsonrpc_request *request,
return;
}
if ((rc = spdk_bdev_open(bdev2, true, NULL, NULL, &desc)) != 0) {
if (spdk_bdev_open(bdev2, true, NULL, NULL, &desc) != 0) {
snprintf(msg, sizeof(msg), "Device %s is in use.", firm_ctx->req->bdev_name);
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, msg);
free(opt);

View File

@ -372,7 +372,7 @@ rpc_decode_metadata(const struct spdk_json_val *val, void *out)
rc = spdk_json_decode_string(val, &text);
if (rc) {
return rc = val->type == SPDK_JSON_VAL_STRING ? -ENOMEM : -EINVAL;
return val->type == SPDK_JSON_VAL_STRING ? -ENOMEM : -EINVAL;
}
text_strlen = strlen(text);