app: Fix scan-build errors due to optarg handling

Change-Id: Ia952f0a962ee63d25ac5297498bffb7e70e5204b
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/407029
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-04-13 07:43:38 +09:00 committed by Daniel Verkamp
parent fa6f7a166d
commit 67f2fb6363

View File

@ -597,15 +597,27 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
rval = SPDK_APP_PARSE_ARGS_HELP;
goto parse_done;
case 'i':
if (optarg == NULL) {
rval = SPDK_APP_PARSE_ARGS_FAIL;
goto parse_done;
}
opts->shm_id = atoi(optarg);
break;
case 'm':
opts->reactor_mask = optarg;
break;
case 'n':
if (optarg == NULL) {
rval = SPDK_APP_PARSE_ARGS_FAIL;
goto parse_done;
}
opts->mem_channel = atoi(optarg);
break;
case 'p':
if (optarg == NULL) {
rval = SPDK_APP_PARSE_ARGS_FAIL;
goto parse_done;
}
opts->master_core = atoi(optarg);
break;
case 'q':