diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-09-08 20:44:06 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2012-03-24 19:29:53 -0400 |
commit | fe9a6b002988372406baf5aeefc046677782365e (patch) | |
tree | cf8cdd1fbef2bc70c0931da5b0e3e8070a7f78c7 /arch/um/drivers | |
parent | da645f3be912a377ada97268e36360b0a4389ab0 (diff) |
um: switch line_config() to setup_one_line()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r-- | arch/um/drivers/line.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c index 08c5fba6db84..b0022cf4efbb 100644 --- a/arch/um/drivers/line.c +++ b/arch/um/drivers/line.c | |||
@@ -572,22 +572,32 @@ int line_config(struct line *lines, unsigned int num, char *str, | |||
572 | { | 572 | { |
573 | struct line *line; | 573 | struct line *line; |
574 | char *new; | 574 | char *new; |
575 | int n; | 575 | char *end; |
576 | int n, err; | ||
576 | 577 | ||
577 | if (*str == '=') { | 578 | if (*str == '=') { |
578 | *error_out = "Can't configure all devices from mconsole"; | 579 | *error_out = "Can't configure all devices from mconsole"; |
579 | return -EINVAL; | 580 | return -EINVAL; |
580 | } | 581 | } |
581 | 582 | ||
582 | new = kstrdup(str, GFP_KERNEL); | 583 | n = simple_strtoul(str, &end, 0); |
584 | if (*end++ != '=') { | ||
585 | *error_out = "Couldn't parse device number"; | ||
586 | return -EINVAL; | ||
587 | } | ||
588 | if (n >= num) { | ||
589 | *error_out = "Device number out of range"; | ||
590 | return -EINVAL; | ||
591 | } | ||
592 | |||
593 | new = kstrdup(end, GFP_KERNEL); | ||
583 | if (new == NULL) { | 594 | if (new == NULL) { |
584 | *error_out = "Failed to allocate memory"; | 595 | *error_out = "Failed to allocate memory"; |
585 | return -ENOMEM; | 596 | return -ENOMEM; |
586 | } | 597 | } |
587 | n = line_setup(lines, num, new, error_out); | 598 | err = setup_one_line(lines, n, new, INIT_ONE, error_out); |
588 | if (n < 0) | 599 | if (err) |
589 | return n; | 600 | return err; |
590 | |||
591 | line = &lines[n]; | 601 | line = &lines[n]; |
592 | return parse_chan_pair(line->init_str, line, n, opts, error_out); | 602 | return parse_chan_pair(line->init_str, line, n, opts, error_out); |
593 | } | 603 | } |