Commit eb9577f8 authored by yidong0635's avatar yidong0635 Committed by Tomasz Zawadzki
Browse files

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: default avataryidong0635 <dongx.yi@intel.com>
Change-Id: I1d58db97b00ac2d102c1a46d7852c2ce3f559fda
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4824


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent fd661859
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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);