aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2010-07-14 22:37:19 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-15 22:05:25 -0400
commit3944ad6848e7ae15a3402372a2df4ae805008321 (patch)
treec1e57da00fcc75462ac16d1009cd5c2c6593a7b6 /drivers/isdn
parent735c65ce4a878b55e08821360fdfd42753cdbe14 (diff)
drivers: isdn: remove custom strtoul()
In this case we safe to use strict_strtoul(). Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Karsten Keil <isdn@linux-pingi.de> Cc: netdev@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/hysdn/hysdn_proclog.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
index 7003698e667d..2ee93d04b2dd 100644
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -16,6 +16,7 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/mutex.h> 18#include <linux/mutex.h>
19#include <linux/kernel.h>
19 20
20#include "hysdn_defs.h" 21#include "hysdn_defs.h"
21 22
@@ -155,9 +156,8 @@ static ssize_t
155hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) 156hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
156{ 157{
157 unsigned long u = 0; 158 unsigned long u = 0;
158 int found = 0; 159 int rc;
159 unsigned char *cp, valbuf[128]; 160 unsigned char valbuf[128];
160 long base = 10;
161 hysdn_card *card = file->private_data; 161 hysdn_card *card = file->private_data;
162 162
163 if (count > (sizeof(valbuf) - 1)) 163 if (count > (sizeof(valbuf) - 1))
@@ -166,32 +166,10 @@ hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t
166 return (-EFAULT); /* copy failed */ 166 return (-EFAULT); /* copy failed */
167 167
168 valbuf[count] = 0; /* terminating 0 */ 168 valbuf[count] = 0; /* terminating 0 */
169 cp = valbuf;
170 if ((count > 2) && (valbuf[0] == '0') && (valbuf[1] == 'x')) {
171 cp += 2; /* pointer after hex modifier */
172 base = 16;
173 }
174 /* scan the input for debug flags */
175 while (*cp) {
176 if ((*cp >= '0') && (*cp <= '9')) {
177 found = 1;
178 u *= base; /* adjust to next digit */
179 u += *cp++ - '0';
180 continue;
181 }
182 if (base != 16)
183 break; /* end of number */
184
185 if ((*cp >= 'a') && (*cp <= 'f')) {
186 found = 1;
187 u *= base; /* adjust to next digit */
188 u += *cp++ - 'a' + 10;
189 continue;
190 }
191 break; /* terminated */
192 }
193 169
194 if (found) { 170 rc = strict_strtoul(valbuf, 0, &u);
171
172 if (rc == 0) {
195 card->debug_flags = u; /* remember debug flags */ 173 card->debug_flags = u; /* remember debug flags */
196 hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags); 174 hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags);
197 } 175 }