net/9p: detect invalid options as much as possible
[sfrench/cifs-2.6.git] / net / 9p / client.c
index 21e6df1cc70f407a85e486d2e26ec7254a6d399b..18c5271910dc2c1e1715efcd2b448b7cee6a844b 100644 (file)
@@ -198,8 +198,6 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                                pr_info("Could not find request transport: %s\n",
                                        s);
                                ret = -EINVAL;
-                               kfree(s);
-                               goto free_and_return;
                        }
                        kfree(s);
                        break;
@@ -214,13 +212,12 @@ static int parse_opts(char *opts, struct p9_client *clnt)
                                         "problem allocating copy of version arg\n");
                                goto free_and_return;
                        }
-                       ret = get_protocol_version(s);
-                       if (ret == -EINVAL) {
-                               kfree(s);
-                               goto free_and_return;
-                       }
+                       r = get_protocol_version(s);
+                       if (r < 0)
+                               ret = r;
+                       else
+                               clnt->proto_version = r;
                        kfree(s);
-                       clnt->proto_version = ret;
                        break;
                default:
                        continue;