diff options
author | Peter Huewe <peterhuewe@gmx.de> | 2011-08-03 10:44:30 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2011-08-03 10:44:21 -0400 |
commit | af6df871ba87ff93739babb16d26160c37c43183 (patch) | |
tree | bb3e2862fa429e941b249c87813f53020eda1b03 /drivers/s390/cio | |
parent | d5f4d113cb9dac182ba44eb605ec4a2f1fdfd3ec (diff) |
[S390] qdio: Use kstrtoul_from_user
This patch replaces the code for getting an unsigned long from a
userspace buffer by a simple call to kstroul_from_user.
This makes it easier to read and less error prone.
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio')
-rw-r--r-- | drivers/s390/cio/qdio_debug.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c index f8b03a636e49..0e615cb912d0 100644 --- a/drivers/s390/cio/qdio_debug.c +++ b/drivers/s390/cio/qdio_debug.c | |||
@@ -188,19 +188,13 @@ static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf, | |||
188 | struct qdio_irq *irq_ptr = seq->private; | 188 | struct qdio_irq *irq_ptr = seq->private; |
189 | struct qdio_q *q; | 189 | struct qdio_q *q; |
190 | unsigned long val; | 190 | unsigned long val; |
191 | char buf[8]; | ||
192 | int ret, i; | 191 | int ret, i; |
193 | 192 | ||
194 | if (!irq_ptr) | 193 | if (!irq_ptr) |
195 | return 0; | 194 | return 0; |
196 | if (count >= sizeof(buf)) | 195 | |
197 | return -EINVAL; | 196 | ret = kstrtoul_from_user(ubuf, count, 10, &val); |
198 | if (copy_from_user(&buf, ubuf, count)) | 197 | if (ret) |
199 | return -EFAULT; | ||
200 | buf[count] = 0; | ||
201 | |||
202 | ret = strict_strtoul(buf, 10, &val); | ||
203 | if (ret < 0) | ||
204 | return ret; | 198 | return ret; |
205 | 199 | ||
206 | switch (val) { | 200 | switch (val) { |