提交 786f0065 编写于 作者: T Thomas Richter 提交者: David S. Miller

lcs: replace sscanf by kstrto function

Since a single integer value is read from the supplied buffer
use the kstrto functions instead of sscanf.
Signed-off-by: NThomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: NFrank Blaschka <blaschka@linux.vnet.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 3d14f661
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册