@@ -113,12 +113,11 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
continue;
token = match_token(p, tokens, args);
if (token < Opt_uname) {
- int r = match_int(&args[0], &option);
- if (r < 0) {
+ ret = match_int(&args[0], &option);
+ if (ret < 0) {
P9_DPRINTK(P9_DEBUG_ERROR,
"integer field, but no integer?\n");
- ret = r;
- continue;
+ goto free_and_return;
}
}
switch (token) {
@@ -196,6 +195,7 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
}
}
+free_and_return:
kfree(tmp_options);
return ret;
@@ -95,12 +95,13 @@ static int parse_opts(char *opts, struct p9_client *clnt)
continue;
token = match_token(p, tokens, args);
if (token < Opt_trans) {
- int r = match_int(&args[0], &option);
- if (r < 0) {
+ ret = match_int(&args[0], &option);
+ if (ret < 0) {
P9_DPRINTK(P9_DEBUG_ERROR,
"integer field, but no integer?\n");
- ret = r;
- continue;
+ if (clnt->trans_mod)
+ v9fs_put_trans(clnt->trans_mod);
+ goto free_and_return;
}
}
switch (token) {
@@ -715,7 +715,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
substring_t args[MAX_OPT_ARGS];
int option;
char *options, *tmp_options;
- int ret;
+ int ret = 0;
opts->port = P9_PORT;
opts->rfd = ~0;
@@ -734,17 +734,15 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
while ((p = strsep(&options, ",")) != NULL) {
int token;
- int r;
if (!*p)
continue;
token = match_token(p, tokens, args);
if (token != Opt_err) {
- r = match_int(&args[0], &option);
- if (r < 0) {
+ ret = match_int(&args[0], &option);
+ if (ret < 0) {
P9_DPRINTK(P9_DEBUG_ERROR,
"integer field, but no integer?\n");
- ret = r;
- continue;
+ goto free_and_return;
}
}
switch (token) {
@@ -762,8 +760,9 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
}
}
+free_and_return:
kfree(tmp_options);
- return 0;
+ return ret;
}
static int p9_fd_open(struct p9_client *client, int rfd, int wfd)
@@ -187,16 +187,14 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
while ((p = strsep(&options, ",")) != NULL) {
int token;
- int r;
if (!*p)
continue;
token = match_token(p, tokens, args);
- r = match_int(&args[0], &option);
- if (r < 0) {
+ ret = match_int(&args[0], &option);
+ if (ret < 0) {
P9_DPRINTK(P9_DEBUG_ERROR,
"integer field, but no integer?\n");
- ret = r;
- continue;
+ goto free_and_return;
}
switch (token) {
case Opt_port:
@@ -217,8 +215,9 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
}
/* RQ must be at least as large as the SQ */
opts->rq_depth = max(opts->rq_depth, opts->sq_depth);
+free_and_return:
kfree(tmp_options);
- return 0;
+ return ret;
}
static int