Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932545AbbLBOC0 (ORCPT ); Wed, 2 Dec 2015 09:02:26 -0500 Received: from mail-lf0-f51.google.com ([209.85.215.51]:35713 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757350AbbLBOCX (ORCPT ); Wed, 2 Dec 2015 09:02:23 -0500 Subject: Re: [PATCH v2 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint To: LABBE Corentin , 3chas3@gmail.com, linux-atm-general@lists.sourceforge.net References: <1449060889-20447-1-git-send-email-clabbe.montjoie@gmail.com> <1449060889-20447-2-git-send-email-clabbe.montjoie@gmail.com> Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org From: Sergei Shtylyov Message-ID: <565EF9EB.3000509@cogentembedded.com> Date: Wed, 2 Dec 2015 17:02:19 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1449060889-20447-2-git-send-email-clabbe.montjoie@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1576 Lines: 49 Hello. On 12/2/2015 3:54 PM, LABBE Corentin wrote: > The simple_strtol function is obsolete. > This patch replace it by kstrtoint. > This will simplify code, since some error case not handled by > simple_strtol are handled by kstrtoint. > > Signed-off-by: LABBE Corentin > --- > drivers/atm/solos-pci.c | 28 +++++++++++++++------------- > 1 file changed, 15 insertions(+), 13 deletions(-) > > diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c > index 3d7fb65..f944d75 100644 > --- a/drivers/atm/solos-pci.c > +++ b/drivers/atm/solos-pci.c > @@ -347,8 +347,8 @@ static char *next_string(struct sk_buff *skb) > */ > static int process_status(struct solos_card *card, int port, struct sk_buff *skb) > { > - char *str, *end, *state_str, *snr, *attn; > - int ver, rate_up, rate_down; > + char *str, *state_str, *snr, *attn; > + int ver, rate_up, rate_down, err; > > if (!card->atmdev[port]) > return -ENODEV; > @@ -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, &ver); > + if (ver < 1 || err) { Is 'ver' initialized in case of error? If not, you have to check 'err' first. [...] MBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/