lkml.org 
[lkml]   [2012]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] sunrpc/cache.h: replace simple_strtoul

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


\
 
 \ /
  Last update: 2012-07-05 21:41    [W:0.051 / U:2.048 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site