Re: [PATCH v3 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint

2015-12-03 Thread LABBE Corentin
On Thu, Dec 03, 2015 at 06:26:31AM -0500, Charles (Chas) Williams wrote:
> On Thu, 2015-12-03 at 09:06 +0100, LABBE Corentin wrote:
> > @@ -357,11 +357,11 @@ static int process_status(struct solos_card *card, 
> > int port, struct sk_buff *skb
> > if (!str)
> > return -EIO;
> >  
> > -   ver = simple_strtol(str, NULL, 10);
> > -   if (ver < 1) {
> > +   err = kstrtoint(str, 10, );
> > +   if (err || ver < 1) {
> > dev_warn(>dev->dev, "Unexpected status interrupt version 
> > %d\n",
> >  ver);
> > -   return -EIO;
> > +   return err;
> 
> 
> If ver < 1 then you might return a 0 here.  Always returning -EIO is
> probably just fine.
> 

Hello

I think the best solution is to split the test, since returning error code from 
kstrtoint was asked by David Miller.
if (err)
return err;
if (ver < 1)
return -EIO;
Thanks
Regards
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint

2015-12-03 Thread Charles (Chas) Williams
On Thu, 2015-12-03 at 09:06 +0100, LABBE Corentin wrote:
> @@ -357,11 +357,11 @@ static int process_status(struct solos_card *card, int 
> port, struct sk_buff *skb
>   if (!str)
>   return -EIO;
>  
> - ver = simple_strtol(str, NULL, 10);
> - if (ver < 1) {
> + err = kstrtoint(str, 10, );
> + if (err || ver < 1) {
>   dev_warn(>dev->dev, "Unexpected status interrupt version 
> %d\n",
>ver);
> - return -EIO;
> + return err;


If ver < 1 then you might return a 0 here.  Always returning -EIO is
probably just fine.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint

2015-12-03 Thread Charles (Chas) Williams
On Thu, 2015-12-03 at 13:58 +0100, LABBE Corentin wrote:
> On Thu, Dec 03, 2015 at 06:26:31AM -0500, Charles (Chas) Williams wrote:
> > On Thu, 2015-12-03 at 09:06 +0100, LABBE Corentin wrote:
> > > @@ -357,11 +357,11 @@ static int process_status(struct solos_card *card, 
> > > int port, struct sk_buff *skb
> > >   if (!str)
> > >   return -EIO;
> > >  
> > > - ver = simple_strtol(str, NULL, 10);
> > > - if (ver < 1) {
> > > + err = kstrtoint(str, 10, );
> > > + if (err || ver < 1) {
> > >   dev_warn(>dev->dev, "Unexpected status interrupt version 
> > > %d\n",
> > >ver);
> > > - return -EIO;
> > > + return err;
> > 
> > 
> > If ver < 1 then you might return a 0 here.  Always returning -EIO is
> > probably just fine.
> > 
> 
> Hello
> 
> I think the best solution is to split the test, since returning error code 
> from kstrtoint was asked by David Miller.
> if (err)
>   return err;
> if (ver < 1)
>   return -EIO;
> Thanks
> Regards

That's fine.  You just shouldn't return 0 if the ver < 1.  This isn't
timing critical code.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html