summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-07-19 11:02:43 +0400
committerChris Ball <cjb@laptop.org>2013-08-25 07:19:05 +0400
commit4be7085f744be070d327ed258d6ceb79b7323f6d (patch)
tree7973091b30cb453a2ff8180b64965c51d6c9f60c /drivers/mmc
parentb3894f267d96146ef2bc5fa21437cb9be4e18254 (diff)
downloadlinux-4be7085f744be070d327ed258d6ceb79b7323f6d.tar.xz
mmc: mmc_test: replace strict_strtol() with kstrtol_from_user()
The usage of strict_strtol() is not preferred, because strict_strtol() is obsolete. Thus, kstrtol() should be used. Also, both kstrtol() and copy_from_user() can be replaced with kstrtol_from_user() to make the code simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/card/mmc_test.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index a69df5216274..0c0fc52d42c5 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -2849,18 +2849,12 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
struct seq_file *sf = (struct seq_file *)file->private_data;
struct mmc_card *card = (struct mmc_card *)sf->private;
struct mmc_test_card *test;
- char lbuf[12];
long testcase;
+ int ret;
- if (count >= sizeof(lbuf))
- return -EINVAL;
-
- if (copy_from_user(lbuf, buf, count))
- return -EFAULT;
- lbuf[count] = '\0';
-
- if (strict_strtol(lbuf, 10, &testcase))
- return -EINVAL;
+ ret = kstrtol_from_user(buf, count, 10, &testcase);
+ if (ret)
+ return ret;
test = kzalloc(sizeof(struct mmc_test_card), GFP_KERNEL);
if (!test)