Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1281837
| From | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint |
| Date | 2015-12-02 15:10 +0100 |
| Message-ID | <qBggB-8db-65@gated-at.bofh.it> (permalink) |
| References | <qBfaO-7ik-11@gated-at.bofh.it> <qBfaO-7ik-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 <clabbe.montjoie@gmail.com>
> ---
> 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/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-12-02 14:00 +0100
Re: [PATCH v2 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-12-02 15:10 +0100
Re: [PATCH v2 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-12-03 09:00 +0100
Re: [PATCH v2 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-12-03 12:50 +0100
csiph-web