kstrto*() can ship return value directly if no additional checks are to be done. Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx> --- block/blk-sysfs.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -33,11 +33,11 @@ queue_var_show(unsigned long var, char *page) static ssize_t queue_var_store(unsigned long *var, const char *page, size_t count) { + unsigned int v; int err; - unsigned long v; - err = kstrtoul(page, 10, &v); - if (err || v > UINT_MAX) + err = kstrtouint(page, 10, &v); + if (err) return -EINVAL; *var = v; @@ -47,15 +47,7 @@ queue_var_store(unsigned long *var, const char *page, size_t count) static ssize_t queue_var_store64(s64 *var, const char *page) { - int err; - s64 v; - - err = kstrtos64(page, 10, &v); - if (err < 0) - return err; - - *var = v; - return 0; + return kstrtos64(page, 10, var); } static ssize_t queue_requests_show(struct request_queue *q, char *page)