diff options
author | Kaitao cheng <pilgrimtao@gmail.com> | 2018-11-06 08:34:54 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-11-27 12:00:52 +0100 |
commit | f88184bfee48d482dfff04cd1eed6906f289db4a (patch) | |
tree | 067c4c0799f3eaef45fcf8c559be96ba67b0c32e /drivers/base/core.c | |
parent | 03c0a9208bb10821e5e3f1c81e6218df32524311 (diff) | |
download | linux-stable-f88184bfee48d482dfff04cd1eed6906f289db4a.tar.gz linux-stable-f88184bfee48d482dfff04cd1eed6906f289db4a.tar.bz2 linux-stable-f88184bfee48d482dfff04cd1eed6906f289db4a.zip |
driver core: Replace simple_strto{l,ul} by kstrtou{l,ul}
The simple_strto{l,ul} are deprecated, use kstrtou{l,ul} instead.
Signed-off-by: Kaitao cheng <pilgrimtao@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 04bbcd779e11..ed145fbfeddf 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -794,10 +794,12 @@ ssize_t device_store_ulong(struct device *dev, const char *buf, size_t size) { struct dev_ext_attribute *ea = to_ext_attr(attr); - char *end; - unsigned long new = simple_strtoul(buf, &end, 0); - if (end == buf) - return -EINVAL; + int ret; + unsigned long new; + + ret = kstrtoul(buf, 0, &new); + if (ret) + return ret; *(unsigned long *)(ea->var) = new; /* Always return full write size even if we didn't consume all */ return size; @@ -818,9 +820,14 @@ ssize_t device_store_int(struct device *dev, const char *buf, size_t size) { struct dev_ext_attribute *ea = to_ext_attr(attr); - char *end; - long new = simple_strtol(buf, &end, 0); - if (end == buf || new > INT_MAX || new < INT_MIN) + int ret; + long new; + + ret = kstrtol(buf, 0, &new); + if (ret) + return ret; + + if (new > INT_MAX || new < INT_MIN) return -EINVAL; *(int *)(ea->var) = new; /* Always return full write size even if we didn't consume all */ |