From: Zhang Zhen <zhenzhang.zhang@huawei.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
<adrian.hunter@intel.com>, Artem Bityutskiy <dedekind1@gmail.com>
Cc: MTD Maling List <linux-mtd@lists.infradead.org>,
Hu Jianyang <hujianyang@huawei.com>
Subject: [PATCH v2] UBIFS: replace simple_strtoul() with kstrtoint()
Date: Tue, 20 May 2014 16:48:11 +0800 [thread overview]
Message-ID: <537B16CB.9070508@huawei.com> (raw)
In-Reply-To: <1400575582-24841-1-git-send-email-zhenzhang.zhang@huawei.com>
use the newer and more pleasant kstrtoint() to replace simple_strtoul(),
because simple_strtoul() is marked for obsoletion.
Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
Signed-off-by: hujianyang <hujianyang@huawei.com>
---
drivers/mtd/ubi/build.c | 7 +++----
fs/ubifs/super.c | 7 ++++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 6e30a3c..77a2884 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -1190,11 +1190,10 @@ static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev)
static struct mtd_info * __init open_mtd_device(const char *mtd_dev)
{
struct mtd_info *mtd;
- int mtd_num;
- char *endp;
+ int mtd_num, ret;
- mtd_num = simple_strtoul(mtd_dev, &endp, 0);
- if (*endp != '\0' || mtd_dev == endp) {
+ ret = kstrtoint(mtd_dev, 0, &mtd_num);
+ if (ret) {
/*
* This does not look like an ASCII integer, probably this is
* MTD device name.
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index a81c7b5..d8c71a6 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1903,7 +1903,7 @@ const struct super_operations ubifs_super_operations = {
static struct ubi_volume_desc *open_ubi(const char *name, int mode)
{
struct ubi_volume_desc *ubi;
- int dev, vol;
+ int dev, vol, ret;
char *endptr;
/* First, try to open using the device node path method */
@@ -1922,10 +1922,11 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode)
if (!isdigit(name[3]))
return ERR_PTR(-EINVAL);
- dev = simple_strtoul(name + 3, &endptr, 0);
+ endptr = (char *)name + 3;
+ ret = kstrtoint(endptr, 0, &dev);
/* ubiY method */
- if (*endptr == '\0')
+ if (!ret)
return ubi_open_volume(0, dev, mode);
/* ubiX_Y method */
--
1.8.1.2
.
next parent reply other threads:[~2014-05-20 8:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1400575582-24841-1-git-send-email-zhenzhang.zhang@huawei.com>
2014-05-20 8:48 ` Zhang Zhen [this message]
2014-05-20 12:21 ` [PATCH v2] UBIFS: replace simple_strtoul() with kstrtoint() Adrian Hunter
2014-05-20 12:31 ` Geert Uytterhoeven
2014-05-20 12:45 ` Adrian Hunter
2014-05-20 12:55 ` Geert Uytterhoeven
2014-05-21 2:22 ` Zhang Zhen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=537B16CB.9070508@huawei.com \
--to=zhenzhang.zhang@huawei.com \
--cc=adrian.hunter@intel.com \
--cc=dedekind1@gmail.com \
--cc=geert@linux-m68k.org \
--cc=hujianyang@huawei.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.