From: Joe Perches <joe@perches.com>
To: Eldad Zack <eldad@fogrefinery.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>,
"J. Bruce Fields" <bfields@fieldses.org>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] sunrpc/cache.h: replace simple_strtoul
Date: Wed, 04 Jul 2012 16:23:47 -0700 [thread overview]
Message-ID: <1341444227.2058.5.camel@joe2Laptop> (raw)
In-Reply-To: <1341442827-21339-2-git-send-email-eldad@fogrefinery.com>
On Thu, 2012-07-05 at 01:00 +0200, Eldad Zack wrote:
> This patch replaces the usage of simple_strtoul with kstrtoint in
> get_int().
Just some trivia:
> diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
[]
> @@ -217,7 +217,7 @@ extern int qword_get(char **bpp, char *dest, int bufsize);
> static inline int get_int(char **bpp, int *anint)
> {
> char buf[50];
> - char *ep;
> + ssize_t ret;
> int rv;
> int len = qword_get(bpp, buf, 50);
This would be nicer as
int len = qword_get(bpp, buf, sizeof(buf));
> @@ -226,8 +226,8 @@ static inline int get_int(char **bpp, int *anint)
> if (len == 0)
> return -ENOENT;
>
> - rv = simple_strtol(buf, &ep, 0);
> - if (*ep)
> + ret = kstrtoint(buf, 0, &rv);
> + if (ret)
> return -EINVAL;
>
> *anint = rv;
ret and rv aren't useful anymore.
Perhaps:
if (kstrtoint(buf, 0, anint))
return -EINVAL;
return 0;
next prev parent reply other threads:[~2012-07-04 23:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-04 23:00 [PATCH 1/2] sunrpc/cache.h: fix coding style Eldad Zack
2012-07-04 23:00 ` [PATCH 2/2] sunrpc/cache.h: replace simple_strtoul Eldad Zack
2012-07-04 23:23 ` Joe Perches [this message]
2012-07-05 18:59 ` Eldad Zack
2012-07-04 23:59 ` J. Bruce Fields
2012-07-05 19:04 ` Eldad Zack
2012-07-05 19:13 ` J. Bruce Fields
2012-07-05 19:57 ` Eldad Zack
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=1341444227.2058.5.camel@joe2Laptop \
--to=joe@perches.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bfields@fieldses.org \
--cc=eldad@fogrefinery.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.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.