From: Frank Blaschka <blaschka@linux.vnet.ibm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org,
Thomas Richter <tmricht@linux.vnet.ibm.com>,
Frank Blaschka <blaschka@linux.vnet.ibm.com>
Subject: [PATCH 5/6] lcs: replace sscanf by kstrto function
Date: Wed, 22 Oct 2014 12:18:06 +0200 [thread overview]
Message-ID: <1413973087-18740-6-git-send-email-blaschka@linux.vnet.ibm.com> (raw)
In-Reply-To: <1413973087-18740-1-git-send-email-blaschka@linux.vnet.ibm.com>
From: Thomas Richter <tmricht@linux.vnet.ibm.com>
Since a single integer value is read from the supplied buffer
use the kstrto functions instead of sscanf.
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
---
drivers/s390/net/lcs.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 0a7d87c..92190aa 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -1943,15 +1943,16 @@ static ssize_t
lcs_portno_store (struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct lcs_card *card;
- int value, rc;
+ int rc;
+ s16 value;
card = dev_get_drvdata(dev);
if (!card)
return 0;
- rc = sscanf(buf, "%d", &value);
- if (rc != 1)
+ rc = kstrtos16(buf, 0, &value);
+ if (rc)
return -EINVAL;
/* TODO: sanity checks */
card->portno = value;
@@ -2007,8 +2008,8 @@ lcs_timeout_store (struct device *dev, struct device_attribute *attr, const char
if (!card)
return 0;
- rc = sscanf(buf, "%u", &value);
- if (rc != 1)
+ rc = kstrtouint(buf, 0, &value);
+ if (rc)
return -EINVAL;
/* TODO: sanity checks */
card->lancmd_timeout = value;
--
1.8.5.5
next prev parent reply other threads:[~2014-10-22 10:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 10:18 [PATCH 0/6 resend] s390: network patches for net-next Frank Blaschka
2014-10-22 10:18 ` [PATCH 1/6] qeth: qeth_core_main make local functions static Frank Blaschka
2014-10-22 10:18 ` [PATCH 2/6] qeth: fix some trace formating issues Frank Blaschka
2014-10-22 10:18 ` [PATCH 3/6] qeth: make local functions static in qeth_l3 module Frank Blaschka
2014-10-22 10:18 ` [PATCH 4/6] qeth: s390 ethernet device driver dependency Frank Blaschka
2014-10-22 10:18 ` Frank Blaschka [this message]
2014-10-22 10:18 ` [PATCH 6/6] ctcm: replace sscanf by kstrto function Frank Blaschka
2014-10-24 5:05 ` [PATCH 0/6 resend] s390: network patches for net-next David Miller
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=1413973087-18740-6-git-send-email-blaschka@linux.vnet.ibm.com \
--to=blaschka@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tmricht@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).