diff options
author | Andy Shevchenko <andy.shevchenko@gmail.com> | 2010-09-07 01:14:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-08 17:10:12 -0400 |
commit | a7a4f1c1a52912eb8b3bd4d8f628d83a8b5d69dd (patch) | |
tree | d683b304fb77097c09eb074140741abacacbfa16 /drivers/isdn | |
parent | fb8621bb6c040a25ac2fc246653859f841a1f53d (diff) |
drivers: isdn: capi: use simple_strtol to convert numbers
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Tilman Schmidt <tilman@imap.cc>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/capi/capidrv.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c index 2978bdaa6b88..e54e79d4e2c1 100644 --- a/drivers/isdn/capi/capidrv.c +++ b/drivers/isdn/capi/capidrv.c | |||
@@ -1515,8 +1515,13 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) | |||
1515 | while (*s) { | 1515 | while (*s) { |
1516 | int digit1 = 0; | 1516 | int digit1 = 0; |
1517 | int digit2 = 0; | 1517 | int digit2 = 0; |
1518 | if (!isdigit(*s)) return -3; | 1518 | char *endp; |
1519 | while (isdigit(*s)) { digit1 = digit1*10 + (*s - '0'); s++; } | 1519 | |
1520 | digit1 = simple_strtoul(s, &endp, 10); | ||
1521 | if (s == endp) | ||
1522 | return -3; | ||
1523 | s = endp; | ||
1524 | |||
1520 | if (digit1 <= 0 || digit1 > 30) return -4; | 1525 | if (digit1 <= 0 || digit1 > 30) return -4; |
1521 | if (*s == 0 || *s == ',' || *s == ' ') { | 1526 | if (*s == 0 || *s == ',' || *s == ' ') { |
1522 | bmask |= (1 << digit1); | 1527 | bmask |= (1 << digit1); |
@@ -1526,8 +1531,12 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep) | |||
1526 | } | 1531 | } |
1527 | if (*s != '-') return -5; | 1532 | if (*s != '-') return -5; |
1528 | s++; | 1533 | s++; |
1529 | if (!isdigit(*s)) return -3; | 1534 | |
1530 | while (isdigit(*s)) { digit2 = digit2*10 + (*s - '0'); s++; } | 1535 | digit2 = simple_strtoul(s, &endp, 10); |
1536 | if (s == endp) | ||
1537 | return -3; | ||
1538 | s = endp; | ||
1539 | |||
1531 | if (digit2 <= 0 || digit2 > 30) return -4; | 1540 | if (digit2 <= 0 || digit2 > 30) return -4; |
1532 | if (*s == 0 || *s == ',' || *s == ' ') { | 1541 | if (*s == 0 || *s == ',' || *s == ' ') { |
1533 | if (digit1 > digit2) | 1542 | if (digit1 > digit2) |