public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eldad Zack <eldad@fogrefinery.com>
To: Joe Perches <joe@perches.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: Thu, 5 Jul 2012 20:59:56 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1207052039080.6660@debianer> (raw)
In-Reply-To: <1341444227.2058.5.camel@joe2Laptop>


On Wed, 4 Jul 2012, Joe Perches wrote:
> 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().
> 
> >  	int len = qword_get(bpp, buf, 50);
> This would be nicer as
> 	int len = qword_get(bpp, buf, sizeof(buf));

I agree, thanks!

> > @@ -226,8 +226,8 @@ static inline int get_int(char **bpp, int *anint)
> > +	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;

Yes, that works better, since kstrtoint() will not write to anint 
unless it's successful, so the whole business with rv is 
indeed redundant.

Looks much neater now thanks to your comments - I will resend it 
a bit later. Should I add you as Signed-off-by?

Eldad

  reply	other threads:[~2012-07-05 19:00 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
2012-07-05 18:59     ` Eldad Zack [this message]
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=alpine.DEB.2.02.1207052039080.6660@debianer \
    --to=eldad@fogrefinery.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=joe@perches.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox