From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com ([134.134.136.24]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wmj4J-0008IQ-MJ for linux-mtd@lists.infradead.org; Tue, 20 May 2014 12:22:56 +0000 Message-ID: <537B48C7.6080105@intel.com> Date: Tue, 20 May 2014 15:21:27 +0300 From: Adrian Hunter MIME-Version: 1.0 To: Zhang Zhen , Geert Uytterhoeven , Artem Bityutskiy Subject: Re: [PATCH v2] UBIFS: replace simple_strtoul() with kstrtoint() References: <1400575582-24841-1-git-send-email-zhenzhang.zhang@huawei.com> <537B16CB.9070508@huawei.com> In-Reply-To: <537B16CB.9070508@huawei.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: MTD Maling List , Hu Jianyang List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 05/20/2014 11:48 AM, Zhang Zhen wrote: > use the newer and more pleasant kstrtoint() to replace simple_strtoul(), > because simple_strtoul() is marked for obsoletion. > > Signed-off-by: Zhang Zhen > Signed-off-by: hujianyang > --- > 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); But endptr is used in the code later, so this is wrong. > > /* ubiY method */ > - if (*endptr == '\0') > + if (!ret) > return ubi_open_volume(0, dev, mode); > > /* ubiX_Y method */ >