um: switch line_remove() to setup_one_line()
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 9 Sep 2011 00:34:52 +0000 (20:34 -0400)
committerRichard Weinberger <richard@nod.at>
Sat, 24 Mar 2012 23:29:53 +0000 (00:29 +0100)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/drivers/line.c

index ac9bcfbbeee1c0f061b520592380584d34f773a1..08c5fba6db84bc0eeb818e150fed653e5b94b95e 100644 (file)
@@ -640,14 +640,11 @@ int line_id(char **str, int *start_out, int *end_out)
 
 int line_remove(struct line *lines, unsigned int num, int n, char **error_out)
 {
-       int err;
-       char config[sizeof("conxxxx=none\0")];
-
-       sprintf(config, "%d=none", n);
-       err = line_setup(lines, num, config, error_out);
-       if (err >= 0)
-               err = 0;
-       return err;
+       if (n >= num) {
+               *error_out = "Device number out of range";
+               return -EINVAL;
+       }
+       return setup_one_line(lines, n, "none", INIT_ONE, error_out);
 }
 
 struct tty_driver *register_lines(struct line_driver *line_driver,